Skip to content

Instantly share code, notes, and snippets.

@philipboomy
Last active October 25, 2019 17:17
Show Gist options
  • Save philipboomy/b4f22c26cca62f0779714ac97ebe7cb2 to your computer and use it in GitHub Desktop.
Save philipboomy/b4f22c26cca62f0779714ac97ebe7cb2 to your computer and use it in GitHub Desktop.
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'), require('autoprefixer')],
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();
};
@philipboomy
Copy link
Author

I am using Twigpack https://plugins.craftcms.com/twigpack

Let me know if you can't get it to work.

@jdsimcoe
Copy link

jdsimcoe commented Oct 22, 2019

Wow, this is cool! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment