Closed ariel-hive closed 7 years ago
CSSO should be last one in CSS processing pipeline. So use csso-loader
as last loader, or just before CSSRTL
.
Hey Iahmatiy, Thanks for the reply!
I have it as far as I can to the end (can't go after sass or it will break everything): { test: /.scss$/, exclude: /(node_modules|bower_components)/, loader: ExtractTextPlugin.extract( 'style-loader', 'css-loader!postcss-loader!csso-loader!sass ) },
CSSRTL is used later on top of the generated css. I did try some debuging and looking at the output from this and CSSO will only keep the /*! if it encapsulates the entire class - otherwise it will be removed
Thank you for clarification. Well, you need use csso
(or any other minifier) after rtlcss
anyway. All minifiers removes comments and it's quite complicate to keep them since CSS is restructing during minification. If you use rtlcss
as a PostCSS
plugin, then you can use postcss-csso.
I think there should be an instruction somewhere how to use rtlcss
with CSS minifiers. @ai, could you help?
@ariel-hive I think main problem in this case is that you run CSS minificator before RTLCSS. All tools was created in thoughts to run CSS minifcator as last step.
@lahmatiy but, I think exclamation comments support is good thing. There is a cases, when comment should be left in minificated version. For example, legacy notes.
@ai Issue is about keeping comments inside rules anchored to a declaration or related things. As you know it's too hard keep those comments while minifying.
Btw exclamation comments are supported by csso
on top level but not inside rules or at-rules, specially for legacy notes.
I am agree that in this case we find a way how to run RTLCSS before csso :)
Btw exclamation comments are supported by csso on top level but not inside rules or at-rules, specially for legacy notes.
Great! It is exactly what I mean.
Closing since issue doesn't related to CSSO itself, but the general problem using RTLCSS with CSS minifiers.
CSSRTL (http://rtlcss.com/) requires /! comments inside the classes and even inline within the css codes in order for it to fully work, for example: `font-family: "Droid Sans", sans-serif /rtl:prepend:"Droid Arabic Kufi",*/; `
However from what I've played around with CSSO (csso-loader for webpack), it will remove all comments inside a class, even the ones marked as /*! (i've even tried comments="exclamation"