Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel Mix 4 with Tailwind and Purge
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
mix.setPublicPath('./web')
.postCss('src/css/main.css', 'css')
.options({
postCss: [tailwindcss('tailwind-config.js')],
processCssUrls: false,
})
.js([
'src/js/main.js',
], 'js')
.browserSync({
proxy: 'http://example.test',
browser: 'firefox',
files: ['templates/*.twig','templates/**/*.twig','web/css/*.css','web/js/*.js']
});
mix.disableSuccessNotifications();
if (mix.inProduction()) {
mix.purgeCss({
enabled: true,
globs: [
path.join(__dirname, 'templates/*.twig'),
path.join(__dirname, 'templates/**/*.twig'),
path.join(__dirname, 'templates/**/**/*.twig'),
path.join(__dirname, 'src/js/*.js'),
],
extensions: ['html', 'js', 'twig', 'vue'],
whitelist: [
],
folders: ['src', 'templates'],
})
.version();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.