Skip to content

deduplicate CSS

Administrator requested to merge dedupe-css into master

Created by: sqs

In ./web and ./client/browser, all Bootstrap CSS rules were duplicated in the output. This is inherently wrong. It also made debugging CSS problems harder and probably slightly slowed down client parsing and loading.

This problem occurred because there were multiple .scss files that imported Bootstrap's CSS, and node-sass doesn't automatically dedupe. Removing those imports would prevent the files from using Bootstrap variables, so the imports need to remain.

This commit introduces optimize-css-assets-webpack-plugin, which uses cssnano to optimize away duplicate CSS rules.

Using node-sass-import-once used to work, but it no longer works (it does not actually eliminate duplicate imports); it is also unmaintained and other people have reported the same problem. node-sass-once-importer also does not work (it yields a completely empty CSS file).

Merge request reports

Loading