GoogleChromeLabs / critters

🦔 A Webpack plugin to inline your critical CSS and lazy-load the rest.

Home Page:https://npm.im/critters-webpack-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicated styles when using `additionalStylesheets` option

rschristian opened this issue · comments

The test added in #87 acts as a reproduction.

The basic gist of the issue is that the pattern used for additionalStylesheets can match the main CSS file, which causes its styles to be duplicated.

If we use a pattern like *.css, the sheet's contents will be added once from additionalStylesheets() and again from embedLinkedStylesheets().

It seems that in the past the use of cssnano deduped these styles and hid the issue, though the current solution doesn't offer that same benefit.

Not sure whether this is a regression or just chance behavior that was relied upon.

I've run into this as well in the past week.

It looks like we'll need to bring back the option of running stylesheets through cssnano.