From 89921f339624e5aeac8fb4173af32da0870ea6ba Mon Sep 17 00:00:00 2001 From: ROUL Date: Sun, 8 Oct 2017 23:33:52 +0200 Subject: [PATCH] Should not purify 'bg-*' and 'text-*' classes Using variables in some ways to set the color (or bg-color) is not reconized by `purifycss` even if they try to thing the more crazy things [https://github.com/purifycss/purifycss#detecting-the-use-of-button-active-1] So, always adding colors in the final packaging could be great for dev more crazy than puryfyccss's team :o) or people using color as functional feature.... --- template/build/css-utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/template/build/css-utils.js b/template/build/css-utils.js index 76717e4..18982d1 100644 --- a/template/build/css-utils.js +++ b/template/build/css-utils.js @@ -73,8 +73,9 @@ module.exports.purify = function(cb) { Promise.all(css.map(function (file) { return new Promise(function (resolve) { - console.log('\n Purifying ' + path.relative(path.join(__dirname, '../dist'), file).bold + '...') - purify(js, [file], {minify: true}, function (purified) { + var notPurifiedClass = ['*bg-*', '*text-*'] + console.log('\n Purifying ' + path.relative(path.join(__dirname, '../dist'), file, ' but not classes ', notPurifiedClass).bold + '...') + purify(js, [file], {minify: true, whitelist: notPurifiedClass}, function (purified) { var oldSize = fs.statSync(file).size fs.writeFileSync(file, purified) var newSize = fs.statSync(file).size