I'm looking into using cssnano via rollup-plugin-postcss
, with the minimize: true
option, but I'm encountering an error whenever I try to use it:
[!] (postcss plugin) TypeError: decl.moveTo is not a function
client_src/css/main.css
TypeError: decl.moveTo is not a function
at path/to/project/node_modules/leaflet/dist/leaflet.css:188:10
at path/to/project/node_modules/cssnano/node_modules/postcss-merge-rules/dist/index.js:246:22
at path/to/project/node_modules/postcss-import/node_modules/postcss/lib/container.js:135:18
at Rule.each (path/to/project/node_modules/postcss-import/node_modules/postcss/lib/container.js:101:16)
at Rule.walk (path/to/project/node_modules/postcss-import/node_modules/postcss/lib/container.js:131:17)
at path/to/project/node_modules/cssnano/node_modules/postcss-merge-rules/dist/index.js:242:18
at path/to/project/node_modules/postcss/lib/container.js:237:28
at path/to/project/node_modules/postcss/lib/container.js:144:26
at Root.each (path/to/project/node_modules/postcss/lib/container.js:110:22)
at Root.walk (path/to/project/node_modules/postcss/lib/container.js:143:21)
at Root.walkRules (path/to/project/node_modules/postcss/lib/container.js:235:25)
After a bunch of digging, it transpired that the issue was with postcss-merge-rules
, which was reported and fixed in ben-eb/postcss-merge-rules#52. Confused, I turned to npm-why
to figure out what was going wrong. It turns out that cssnano
is still depending on version 2.1.2 of postcss-merge-rules
- even though the latest version is 4.0.2!
$ npm-why postcss-merge-rules
Who required postcss-merge-rules:
my-project > rollup-plugin-postcss > cssnano > [email protected]
However, there's an additional twist in the tale. Upon reporting this to the cssnano
project in cssnano/cssnano#676, I discovered that the issue wasn't with cssnano at all - it's with this plugin (rollup-plugin-postcss) - which is depending on an ancient version of cssnano.
Could cssnano be updated please? I'd like very much to be able to minimise my css, but I can't do so currently :-/
More information is, of course, available upon request.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too