-
-
Save adamwathan/7796ee4dced569cc31d5cf83c62b8f89 to your computer and use it in GitHub Desktop.
Two Tailwind Configs with Webpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"private": true, | |
"scripts": { | |
"dev": "npm run development", | |
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", | |
"watch": "npm run development -- --watch", | |
"watch-poll": "npm run watch -- --watch-poll", | |
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", | |
"prod": "npm run production", | |
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" | |
}, | |
"devDependencies": { | |
"@babel/core": "^7.3.3", | |
"@babel/preset-env": "^7.3.1", | |
"axios": "^0.18", | |
"babel-loader": "^8.0.5", | |
"bootstrap": "^4.0.0", | |
"cross-env": "^5.1", | |
"css-loader": "^2.1.0", | |
"extract-text-webpack-plugin": "4.0.0-beta.0", | |
"jquery": "^3.2", | |
"lodash": "^4.17.5", | |
"mini-css-extract-plugin": "^0.5.0", | |
"popper.js": "^1.12", | |
"postcss-loader": "^3.0.0", | |
"resolve-url-loader": "^2.3.1", | |
"sass": "^1.15.2", | |
"sass-loader": "^7.1.0", | |
"tailwindcss": "^0.7.4", | |
"vue": "^2.5.17", | |
"vue-loader": "^15.6.4", | |
"vue-template-compiler": "^2.5.22", | |
"webpack": "^4.29.5", | |
"webpack-bundle-analyzer": "^3.0.4", | |
"webpack-cli": "^3.2.3", | |
"webpack-fix-style-only-entries": "^0.2.0", | |
"webpack-manifest-plugin": "^2.0.4", | |
"webpack-notifier": "^1.7.0" | |
}, | |
"browserslist": [ | |
"> 1%" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const VueLoaderPlugin = require('vue-loader/lib/plugin'); | |
const ManifestPlugin = require('webpack-manifest-plugin'); | |
const WebpackNotifierPlugin = require('webpack-notifier'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const ExtractTailwindA = new ExtractTextPlugin('css/tailwindA.css'); | |
const ExtractTailwindB = new ExtractTextPlugin('css/tailwindB.css'); | |
module.exports = (env, argv) => ({ | |
entry: { | |
'js/app': [ | |
'./resources/js/app.js', | |
'./resources/tailwind/tailwindA.css', | |
'./resources/tailwind/tailwindB.css', | |
], | |
}, | |
output: { | |
path: `${__dirname}/public`, | |
publicPath: '/', | |
filename: '[name].js', | |
chunkFilename: 'js/[name]-[chunkhash].js', | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.vue$/, | |
use: 'vue-loader', | |
}, | |
{ | |
test: /\.js$/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['@babel/preset-env'], | |
plugins: [], | |
}, | |
}, | |
exclude: /node_modules/, | |
}, | |
{ | |
test: `${__dirname}/resources/tailwind/tailwindA.css`, | |
use: ExtractTailwindA.extract({ | |
use: [ | |
'css-loader', | |
{ | |
loader: 'postcss-loader', | |
options: { | |
plugins: () => [ | |
require('tailwindcss')('./resources/tailwind/tailwind.configA.js'), | |
], | |
}, | |
}, | |
] | |
}) | |
}, | |
{ | |
test: `${__dirname}/resources/tailwind/tailwindB.css`, | |
use: ExtractTailwindB.extract({ | |
use: [ | |
'css-loader', | |
{ | |
loader: 'postcss-loader', | |
options: { | |
plugins: () => [ | |
require('tailwindcss')('./resources/tailwind/tailwind.configB.js'), | |
], | |
}, | |
}, | |
] | |
}) | |
}, | |
], | |
}, | |
resolve: { | |
extensions: ['.vue', '.js', '.css'], | |
alias: { | |
vue$: 'vue/dist/vue.esm.js', | |
}, | |
}, | |
plugins: [ | |
new VueLoaderPlugin(), | |
ExtractTailwindA, | |
ExtractTailwindB, | |
new WebpackNotifierPlugin({ | |
alwaysNotify: true, | |
excludeWarnings: true, | |
}), | |
new ManifestPlugin({ | |
fileName: 'mix-manifest.json', | |
basePath: '/', | |
publicPath: '/', | |
}), | |
], | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://laracasts.com/discuss/channels/elixir/multiple-tailwind-configs-for-theming