Last active
October 25, 2019 17:17
-
-
Save philipboomy/b4f22c26cca62f0779714ac97ebe7cb2 to your computer and use it in GitHub Desktop.
Laravel Mix 4 with Tailwind and Purge
This file contains 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 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(); | |
}; |
Wow, this is cool! Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using Twigpack https://plugins.craftcms.com/twigpack
Let me know if you can't get it to work.