meteor / meteor-feature-requests

A tracker for Meteor issues that are requests for new functionality, not bugs.
Other
89 stars 3 forks source link

Expose `mergeCss` function from `standard-minifier-css` package #432

Open moberegger opened 3 years ago

moberegger commented 3 years ago

There is a useful mergeCss function in the standard-minifier-css package that does the following (according to the comments):

Lints CSS files and merges them into one file, fixing up source maps and pulling any @import directives up to the top since the CSS spec does not allow them to appear in the middle of a file.

From what I can tell, this steps looks like a pre-requisite for any custom minifier logic, but it is not exposed in any way. Off hand, I am aware of two packages that have copied this implementation detail over:

I had to do the same thing when I wanted to build my own postcss implementation. I think it would be a good idea to expose this as an API in someway to developers, because there can be lower level improvements made to the core css minifier that won't be reflected in other minifer projects without copying it over again. It would be nice if community minifier packages could leverage any improvements made in the core project for little cost.

A few ideas that could work:

At a glance, the first option looks like the easiest one to implement, as CssTools is already exposed with the current setup.