aitor
January 3, 2021, 12:16pm
1
[EDIT] It is something purgeCss related. Comenting purgeCss in webpack.mix.js fix the problem. Maybe purgeCss cant see inside SVG.
Hi, I’m working on this prototype:
https://d3.e451.net/
These buttons has a SVG with a simple path:
its fill color changes regarding its class:
It works well at yarn build
and it doesn’t work at yarn build:production
. I’ve noticed that any SCSS containing path
selector is not transpiled to plain CSS when is buit to production. It Is completely removed from CSS.
Is it a bug or an expected behavior?
aitor
January 3, 2021, 4:47pm
2
Adding my own whitelist for purgeCSS to webpack.mix.js
(note “path” at the end of the list).
let whitelist = [
'rtl',
'home',
'blog',
'archive',
'date',
'error404',
'logged-in',
'admin-bar',
'no-customize-support',
'custom-background',
'wp-custom-logo',
'alignnone',
'alignright',
'alignleft',
'wp-caption',
'wp-caption-text',
'screen-reader-text',
'comment-list',
'path',
];
mix
.sass('resources/assets/styles/app.scss', 'styles')
.sass('resources/assets/styles/editor.scss', 'styles')
.purgeCss({
extend: { content: [path.join(__dirname, 'index.php')] },
whitelist: whitelist,
whitelistPatterns: require('purgecss-with-wordpress').whitelistPatterns,
});
Original list:
whitelist: [
'rtl',
'home',
'blog',
'archive',
'date',
'error404',
'logged-in',
'admin-bar',
'no-customize-support',
'custom-background',
'wp-custom-logo',
'alignnone',
'alignright',
'alignleft',
'wp-caption',
'wp-caption-text',
'screen-reader-text',
'comment-list',
],
1 Like
system
Closed
February 14, 2021, 12:16pm
3
This topic was automatically closed after 42 days. New replies are no longer allowed.