saberland/saber

Allow to extract CSS into standalone files #94

egoist posted onGitHub

<!-- Please don't delete this template or we'll close your issue -->

<!-- Before creating an issue please make sure you are using the latest version of Saber. -->

Feature request

<!-- Please ask questions via following several ways. -->

<!-- https://chat.saber.land/ -->

<!-- https://stackoverflow.com/questions/ask?tags=saberjs -->

What problem does this feature solve?

Extract CSS for better caching.

What does the proposed API look like?

Currently:

  • in prod, Saber inlines critical CSS in the initial HTML, other CSS are injected via <script> tag dynamically
  • in dev, all CSS are injected dynamically

Since mini-css-extract-plugin supports hot reloading now, maybe we can use it in both dev and prod, it can be enabled with an option: build.extractCSS.

We need to ensure that CSS being used by two or more chunks are split into a vendor chunk, i.e. style-vendor.css.

How should this be implemented in your opinion?

N/A

Are you willing to work on this yourself?

PR welcome.


Fund this Issue

$0.00
Funded

Pull requests