SassNinja / postcss-extract-media-query

PostCSS plugin to extract all media query from CSS and emit as separate files.
MIT License
130 stars 20 forks source link

cssnano and sourcemaps #3

Closed kingmauri closed 4 years ago

kingmauri commented 5 years ago

did someone tried to create correct sourcemaps after the extraction? and my 2nd question is: is it possible to run cssnano to minify all extracted files directly without any temporary folder? there is an option for that i know, but cssnano do a lot more than just minify.

thx!! great plugin!!

SassNinja commented 5 years ago

did someone tried to create correct sourcemaps after the extraction?

not supported yet it's quite challenging to implement because I think it depends on the build tool and to support all is not trivial

what build tool do you use?

is it possible to run cssnano to minify all extracted files directly without any temporary folder?

at the moment not possible because the minimization is hard coded in the plugin but I've plans to change this with the next major release (v2) and support any other postcss plugin.

but I haven't had time to work on this plugin

qodesmith commented 5 years ago

@SassNinja Just noticed that csswring is deprecated. This plugin uses that for the minimize option. Would you be open to a PR that changes to using cssnano instead?

SassNinja commented 4 years ago

@kingmauri I've finally found some time to take (partially) care of your feature requests

and my 2nd question is: is it possible to run cssnano to minify all extracted files directly without any temporary folder? there is an option for that i know, but cssnano do a lot more than just minify.

yes, since v2 (released a minute ago) it's possible to use whatever you like for minification as I parse the postcss.config.js and apply all subsequent PostCSS plugins to the extracted CSS as well

did someone tried to create correct sourcemaps after the extraction?

I've tried hard to also add source map support in v2.0.0 but it's really complicated because there are inconsistencies across the build tools (gulp behaves different to e.g. webpack) and I haven't found a way yet to always access the map within my plugin.

For more information you may follow this discussion https://github.com/postcss/postcss/issues/1312

SassNinja commented 4 years ago

@qodesmith thanks for the offer!

however this has become obsolete since v2 because the minimize option has been removed

mgrsskls commented 3 years ago

Hi @SassNinja,

first of all thanks for the nice plugin! :)

Did you get by any chance get any further with generating source maps?

Thanks!