From a8088c148caf7a8cfc3e05b6f709b4ba0b507403 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 30 Jan 2018 22:52:53 +0000 Subject: [PATCH] Revert "Disable PurgeCSS for now" This reverts commit 73a7a80a3352da761f913fe604ae3095c3c278db. --- webpack.config.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index d2f7df7a..585231b3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,12 +10,13 @@ var PurgecssPlugin = require('purgecss-webpack-plugin'); * https://github.com/FullHuman/purgecss-webpack-plugin */ class TailwindExtractor { - static extract(content) { - return content.match(/[A-z0-9-:\/]+/g); - } + static extract(content) { + return content.match(/[A-z0-9-:\/]+/g); + } } -Encore.cleanupOutputBeforeBuild() +Encore + .cleanupOutputBeforeBuild() .setOutputPath('source/build/') .setPublicPath('/build') .enableLessLoader() @@ -26,19 +27,22 @@ Encore.cleanupOutputBeforeBuild() path: 'postcss.config.js' }; }) - .enableSourceMaps(!Encore.isProduction()); + .enableSourceMaps(!Encore.isProduction()) +; // PurgeCSS -// Encore.addPlugin(new PurgecssPlugin({ -// paths: glob.sync([ -// path.join(__dirname, "source/**/*.{twig,html,md}") -// ]), -// extractors: [ -// { -// extractor: TailwindExtractor, -// extensions: ['twig', 'html', 'md'] -// } -// ] -// })); +Encore.addPlugin( + new PurgecssPlugin({ + paths: glob.sync([ + path.join(__dirname, "source/**/*.{twig,html,md}") + ]), + extractors: [ + { + extractor: TailwindExtractor, + extensions: ['twig', 'html', 'md'] + } + ] + }) +); module.exports = Encore.getWebpackConfig();