Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Output optimization #3029

Closed
mastermehdi opened this issue Feb 10, 2017 · 5 comments
Closed

CSS Output optimization #3029

mastermehdi opened this issue Feb 10, 2017 · 5 comments

Comments

@mastermehdi
Copy link

mastermehdi commented Feb 10, 2017

Can we add a new feature to mixin for supporting this state?

.test() { color: white; } .test() { color: red; } body { .test() }

Compiled to:
a { color: white; color: red; }

But desired compile is:
a { color: red; }

@seven-phases-max
Copy link
Member

seven-phases-max commented Feb 11, 2017

We could, but why would we?
(I've already suggested you to start with https://github.com/less/less.js/blob/master/CONTRIBUTING.md. I.e. if you propose some feature it's better to have some use-case/rationale behind, beside just "I need that". otherwise the answer is always "No").

From your example it's not even clear if you're looking for a CSS output optimization (i.e. a feature that eliminates "duplicated" properties where necessary - in that case all you need is a descent CSS minifier, e.g. clean-css with corresponding settings will do it for you).

Or if you're proposing a mixin overriding feature, which is another story, then the further discussion badly needs a concrete use-case example(s). Start with #1372, #2532 and other related tickets referenced there to collect some background.

@seven-phases-max
Copy link
Member

Not closing yet, but it's either "Not a Less scope (use a minifier)" or a duplicate of #2532.

@mastermehdi
Copy link
Author

When we use 'css minifiers', all of the css files minified! but if we want it just for some parts, we must have a feature to do this!
also we don't want 'mixin overwrite' for some reasons such as compatibilities with all browser!

@seven-phases-max
Copy link
Member

seven-phases-max commented Feb 12, 2017

all of the css files minified! but if we want it just for some parts, we must have a feature to do this!

You can always apply csscomb after css-clean. Yet again, output microoptimization and formatting are out of the Less scope (the compiler just can't afford to be burdened by another output analysis layer to do something that's already being done well by other dedicated tools, especially since these tools will always do it better. It's just a waste of time and efforts.)

@seven-phases-max
Copy link
Member

seven-phases-max commented Feb 12, 2017

Closing as out of the Less scope (use clean-css and csscomb, both are even available as Less plugins).

@seven-phases-max seven-phases-max changed the title New mixin feature CSS Output optimization Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants