Last active
February 4, 2020 18:24
-
-
Save djwave28/3db949a782d03ef492917fac319708ef to your computer and use it in GitHub Desktop.
mix with tailwinds + postcss
This file contains hidden or 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'); | |
require('laravel-mix-purgecss'); | |
/* | |
Using tailwinds @apply command will throw an error when compiling through postcss | |
-- fixes `@apply` cannot be used with | |
Generate the full tailwinds library with | |
# npx tailwind init tailwindcss.full.js --full | |
*/ | |
mix.js('resources/js/app.js', 'public/js'); | |
mix.sass('resources/sass/app.scss', 'public/css') | |
.options({ | |
processCssUrls: false, | |
postCss: [ | |
require('postcss-css-variables')(), | |
require('postcss-import')(), | |
require('postcss-nesting')(), | |
require('tailwindcss')('./tailwind.config.js'), | |
require('tailwindcss')('./tailwindcss.full.js'), | |
] | |
}) | |
.sourceMaps(); | |
if (mix.inProduction()) { | |
mix | |
.version() | |
.purgeCss(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment