Skip to content

Commit

Permalink
Merge branch 'laurencei-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldyrynda committed Jan 22, 2018
2 parents 9b4a2f9 + acb15a2 commit 3ea3d8e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/TailwindCssPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ protected static function updatePackageArray(array $packages)
{
return [
'tailwindcss' => '^0.4.0',
'glob-all' => '*',
'purgecss-webpack-plugin' => '*'
] + Arr::except($packages, ['bootstrap-sass', 'jquery']);
}

Expand Down
40 changes: 39 additions & 1 deletion src/tailwindcss-stubs/webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
let mix = require('laravel-mix');
var tailwindcss = require('tailwindcss');
let tailwindcss = require('tailwindcss');
let glob = require("glob-all");
let PurgecssPlugin = require("purgecss-webpack-plugin");

class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g) || [];
}
}

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -31,3 +39,33 @@ mix.js('resources/assets/js/app.js', 'public/js')
// processCssUrls: false,
// postCss: [ tailwindcss('tailwind.js') ],
// });

// PurgeCSS is a utility that parses your application view files, identifies which
// utility classes are actually being used, removing unused classes. This means
// your final CSS will be much smaller, containing just the styles you need.
//
// Only run PurgeCSS in production builds keeping your development builds fast,
// whilst still leaving you with a full set of utilities during development.
// if (mix.inProduction()) {
// mix.webpackConfig({
// plugins: [
// new PurgecssPlugin({
//
// // Specify the locations of any files you want to scan for class names.
// paths: glob.sync([
// path.join(__dirname, "resources/views/**/*.blade.php"),
// path.join(__dirname, "resources/assets/js/**/*.vue")
// ]),
// extractors: [
// {
// extractor: TailwindExtractor,
//
// // Specify the file extensions to include when scanning for class names.
// extensions: ["html", "js", "php", "vue"]
// }
// ]
// })
// ]
// });
// }

0 comments on commit 3ea3d8e

Please sign in to comment.