Skip to content

Instantly share code, notes, and snippets.

@Ashraam
Created June 19, 2019 09:20
Show Gist options
  • Save Ashraam/b2af206aa8eea472680f63921c675b33 to your computer and use it in GitHub Desktop.
Save Ashraam/b2af206aa8eea472680f63921c675b33 to your computer and use it in GitHub Desktop.
Laravel Mix + Tailwind CSS + PurgeCss
{
"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": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"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": {
"axios": "^0.17",
"cross-env": "^5.1",
"laravel-mix": "^2.0",
"laravel-mix-purgecss": "^1.0",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"lodash": "^4.17.4",
"tailwindcss": "^0.4",
"vue": "^2.5.7"
}
}
let mix = require('laravel-mix');
let tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/assets/js/app.js', 'public/js')
.less('resources/assets/less/app.less', 'public/css')
.options({
postCss: [
tailwindcss('tailwind.js'),
]
});
if (mix.inProduction()) {
mix.purgeCss()
.version();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment