From 5393186141b559ba3e32e659e744729bcef81d87 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 19 May 2020 17:45:52 +0100 Subject: [PATCH] Enable PurgeCSS via Tailwind config file Fixes #40 --- web/themes/custom/opdavies/package-lock.json | 5 ----- web/themes/custom/opdavies/package.json | 1 - web/themes/custom/opdavies/tailwind.config.js | 12 +++++++++++- web/themes/custom/opdavies/webpack.mix.js | 10 ---------- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/web/themes/custom/opdavies/package-lock.json b/web/themes/custom/opdavies/package-lock.json index 3269696..153c855 100644 --- a/web/themes/custom/opdavies/package-lock.json +++ b/web/themes/custom/opdavies/package-lock.json @@ -196,11 +196,6 @@ "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", "dev": true }, - "alpinejs": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-2.3.5.tgz", - "integrity": "sha512-/zQiqmiM3gBVKD+yeP7p9XzOXfhxxDMAfoaJRpXiAJykGaeSe3L+bvp/a6uRQMygPV+UUdgAk8fdfToJttRcUQ==" - }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", diff --git a/web/themes/custom/opdavies/package.json b/web/themes/custom/opdavies/package.json index 34b0efd..7bffd7b 100644 --- a/web/themes/custom/opdavies/package.json +++ b/web/themes/custom/opdavies/package.json @@ -13,7 +13,6 @@ "cross-env": "^5.2.0", "highlightjs": "^9.16.2", "laravel-mix": "^2.1.14", - "laravel-mix-purgecss": "^5.0.0-rc.1", "postcss-import": "^12.0.1", "postcss-nested": "^4.2.1", "tailwindcss": "^1.0.1" diff --git a/web/themes/custom/opdavies/tailwind.config.js b/web/themes/custom/opdavies/tailwind.config.js index 65a623d..0b53ba8 100644 --- a/web/themes/custom/opdavies/tailwind.config.js +++ b/web/themes/custom/opdavies/tailwind.config.js @@ -3,7 +3,17 @@ const {fontFamily, spacing} = require('tailwindcss/defaultTheme') module.exports = { important: true, - purge: false, + purge: { + content: [ + 'templates/**/*.twig', + + // Include any classes used within config (e.g. within views). + '../../../../config/**/*.yml' + ], + options: { + whitelist: [], + } + }, theme: { extend: { colors: { diff --git a/web/themes/custom/opdavies/webpack.mix.js b/web/themes/custom/opdavies/webpack.mix.js index ffc0077..4098a79 100644 --- a/web/themes/custom/opdavies/webpack.mix.js +++ b/web/themes/custom/opdavies/webpack.mix.js @@ -1,18 +1,8 @@ let mix = require('laravel-mix'); -// require('laravel-mix-purgecss') - mix.postCss('src/tailwind.pcss', 'dist', [ require('postcss-import'), require('tailwindcss'), require('postcss-nested'), require('autoprefixer') ]) - -// mix.purgeCss({ -// paths: () => glob.sync([ -// path.join(__dirname, '**/*.twig') -// ]), -// whitelistPatterns: [], -// whitelistPatternsChildren: [] -// })