Skip to content

Instantly share code, notes, and snippets.

@mgussekloo
Created November 28, 2017 10:42
Show Gist options
  • Save mgussekloo/38d10ea75a47df83763c1aa39258d830 to your computer and use it in GitHub Desktop.
Save mgussekloo/38d10ea75a47df83763c1aa39258d830 to your computer and use it in GitHub Desktop.
My config for Laravel Mix with PurgeCSS.
let mix = require('laravel-mix');
let glob = require('glob-all');
let PurgecssPlugin = require('purgecss-webpack-plugin');
/*
|--------------------------------------------------------------------------
| 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 your application, as well as bundling up your JS files.
|
*/
mix.setPublicPath('static');
mix.options({ processCssUrls: false });
mix.webpackConfig({
plugins: [
new PurgecssPlugin({
paths: glob.sync([
path.join(__dirname, "templates/**/*.twig"),
path.join(__dirname, "resources/scripts/**/*.vue")
])
})
]
});
mix.copy('resources/images', 'static/images');
mix.copy('resources/fonts', 'static/fonts');
mix.js('resources/scripts/app.js', 'app.js');
mix.sass('resources/styles/app.scss', 'app.css');
mix.version();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment