Skip to content

Instantly share code, notes, and snippets.

@viirre
Last active April 20, 2020 22:24
Show Gist options
  • Save viirre/994d2dc6ac2036cbbd3fde450551e509 to your computer and use it in GitHub Desktop.
Save viirre/994d2dc6ac2036cbbd3fde450551e509 to your computer and use it in GitHub Desktop.
Using different Tailwind config files (eg. one for admin and one for front) with Laravel Mix (TailwindCSS < 1.0)
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
mix
.js('resources/js/admin/admin.js', 'public/js')
.js('resources/js/front/front.js', 'public/js')
// Admin
.sass(
'resources/sass/admin.scss',
'public/css/',
{}, // sass-loader plugin options
[tailwindcss('./tailwind-admin.js')] // postcss plugins
)
// Front
.sass(
'resources/sass/front.scss',
'public/css/',
{}, // sass-loader plugin options
[tailwindcss('./tailwind-front.js')] // postcss plugins
)
.options({
processCssUrls: false,
})
.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