Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

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

Open
moberegger opened this issue May 19, 2021 · 0 comments
Open

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

moberegger opened this issue May 19, 2021 · 0 comments

Comments

@moberegger
Copy link

moberegger commented May 19, 2021

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:

  • Move the logic over to the minifier-css package and add it to the exposed CssTools object.
  • Add a new merge method to CssToolsMinifier class, and custom minifier plugins can extend from that, with access to this.merge(...)
  • Add a new meteor package with this functionality, although I don't know how that can be exposed to other plugins.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants