cheton / browserify-css

A Browserify transform for bundling, rebasing, inlining, and minifying CSS files.
http://cheton.github.io/browserify-css/
MIT License
144 stars 22 forks source link

Bundling css ends up with only first file instead of all occurences of require("[...]/[somename].css"); #62

Open ghost opened 6 years ago

ghost commented 6 years ago

As in title. Bundling css files ends up with only first file in bundle.css instead of all occurences of require("[...]/[somename].css"); in all js files that participate.

Is there some option for enabling concatenated?

It is (from docs):

onFlush = (options, done) => {
  Fs.appendFileSync(outputPath, options.data);
  done(null); // Do not embed CSS into a JavaScript bundle
};

and at the beginning of bundling we need to unlink file outputPath

problem is when we use watchify

Because of removing outputPath file at the beginning of bundling, cached(by watchify) .js modules that required css files won't require css files again in case when .js module hasn't changed, but they need to because we've removed whole css bundle.

Any idea?