You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something that has been discussed here numerous times, but I think the consensus has been (should be still) that this is not something that belongs in less.js (for all of the reasons described in the other issues - run a search and you'll find a few).
However, I do think this is a great example of the kind of thing plugins ought to do, so I'll leave this open until others have a chance to weigh in on it.
Hmm, and why you need it to be integrated into Less? You can use it with Less w/o any special integration.
And yes, Autoprefixer supports sourcemap input since v1.
From my perspective, it'd be awesome to see Less and Sass address this to help move projects and the web in general forward. Having to create extensive libraries of mixins just sucks. Folks want a mixin for everything, but I don't think that should be the case. Mixins make the most sense when creating code shortcuts (e.g., clearfix, image replacement, etc).
Moreover, I'd argue the vision of a CSS preprocessor should be to eliminate itself. Improving the core CSS language should the ultimate goal, and having this as part of Less and Sass opens the door to so many more people for writing more bulletproof code, now and forever.
it'd be awesome to see Less and Sass address this.
Hmm, I'm not sure I understand how (and why) preprocessors should "address this" specifically. We just doput the AP tool after the PP tool in the building chain, that's it.
Right, that fixes it for us, and those using Grunt. Not everyone uses Grunt or another build tool.
When I say Less and Sass should address this, I mean that auto-prefixing CSS3 properties should happen automatically (and be configurable) within the core Less and Sass projects. An external tool shouldn't be necessary.
I'd argue the vision of a CSS preprocessor should be to eliminate itself.
Amen. I could not have articulated my view any better than this line. Sums it up well.
I mean that auto-prefixing CSS3 properties should happen automatically (and be configurable) within the core Less and Sass projects. An external tool shouldn't be necessary.
This is the kind of feedback that I was looking for when I left the issue open. @mdo / @stevenvachon would it make a material difference if this functionality was supplied by a plugin that for all intents and purposes "felt" like it was native, and not like an external tool (meaning that it wouldn't rely on a third party build chain, Less.js would do all the work)?
@jonschlinkert sure, but would it work with Less.js' dev mode and would it produce accurate source maps relative to the Less code and not its CSS output?
@stevenvachon well, that brings up a good point - I guess (like most things) it will depend on expectations. So maybe the first thing to do is for us to outline these things and get consensus on what the autoprefixer would be expected to do.
Then @lukeapage / @seven-phases-max can decide whether or not a plugin would work, or if it needs to be implemented natively.
export an accurate source map that is relative to the Less.js stylesheet and not its CSS output
Not sure if anyone has anything to add to that.
As to whether it should be a plugin or a native feature, I'd push for native as it maintains Less.js' ease of use and brings everything closer to achieving @mdo's summary of what a pre-processor should be.
@jonschlinkert that link you posted, does it have a reference of properties/rules that get prefixed? And, does it—should it—have a source for updates (like autoprefixer does with caniuse.com)?
@stevenvachon If I understand it correctly the agreement is to provide whatever post-preprocessing via plugins and not as a dedicated core-options. (I.e. to add autoprefixer or myth or anything you just write a plugin which registers itself as a postprocessor and applies desired transformations to the output CSS). In other words it looks like we're building mini-grunt here 🚲 :)
I don't use task runners as much anymore; maybe others are doing the same?
You will then. lessc/less.js becomes a task-runner as soon as you put all that stuff in. So it's just a matter of naming things by their true names w/o getting shy ;)
What I mean is that I don't use Grunt/Gulp much anymore.
Yes, I've got it above. I mean it does not matter how the thing is named: gulp, grunt, build.js, build.bat, build.sh, lessc (with all stuff inside), in general it's all the same "build chain" essentially.
less.render returns a promise on v2 if no callback is specified.
Yes, my bad, I guess just overgeneralized things a bit to not confuse even more :) (In other words, the real purpose of the callback and/or promise there is that it can make async things more simple and/or make error handling more easy... If that would not be necessary it could just really return a string and never care of anything that happens after that (if it could be "just" Less compiler :).)
less-plugin-autoprefix is now on npm and works with the (just release) beta v2 of lessc. I've started mentioning autoprefixer in the docs and I hope more people take advantage of how easy it is to use now, even without a build process.
Activity
jonschlinkert commentedon Mar 6, 2014
This is something that has been discussed here numerous times, but I think the consensus has been (should be still) that this is not something that belongs in less.js (for all of the reasons described in the other issues - run a search and you'll find a few).
However, I do think this is a great example of the kind of thing plugins ought to do, so I'll leave this open until others have a chance to weigh in on it.
mdo commentedon Mar 6, 2014
Came here to look up and ask for the same thing. It'd be amazing to see the preprocessors like Less and Sass address this.
stevenvachon commentedon Mar 6, 2014
If it were written as a plugin, would it affect sourcemap accuracy?
seven-phases-max commentedon Mar 6, 2014
Hmm, and why you need it to be integrated into Less? You can use it with Less w/o any special integration.
And yes, Autoprefixer supports sourcemap input since v1.
mdo commentedon Mar 6, 2014
From my perspective, it'd be awesome to see Less and Sass address this to help move projects and the web in general forward. Having to create extensive libraries of mixins just sucks. Folks want a mixin for everything, but I don't think that should be the case. Mixins make the most sense when creating code shortcuts (e.g., clearfix, image replacement, etc).
Moreover, I'd argue the vision of a CSS preprocessor should be to eliminate itself. Improving the core CSS language should the ultimate goal, and having this as part of Less and Sass opens the door to so many more people for writing more bulletproof code, now and forever.
seven-phases-max commentedon Mar 7, 2014
Hmm, I'm not sure I understand how (and why) preprocessors should "address this" specifically. We just do put the AP tool after the PP tool in the building chain, that's it.
mdo commentedon Mar 7, 2014
Right, that fixes it for us, and those using Grunt. Not everyone uses Grunt or another build tool.
When I say Less and Sass should address this, I mean that auto-prefixing CSS3 properties should happen automatically (and be configurable) within the core Less and Sass projects. An external tool shouldn't be necessary.
stevenvachon commentedon Mar 7, 2014
@seven-phases-max autoprefixer supports source maps with less' output css, not less' raw source input.
There's also the argument for autoprefixer in "development mode", without the need for a task runner.
jonschlinkert commentedon Mar 7, 2014
Amen. I could not have articulated my view any better than this line. Sums it up well.
This is the kind of feedback that I was looking for when I left the issue open. @mdo / @stevenvachon would it make a material difference if this functionality was supplied by a plugin that for all intents and purposes "felt" like it was native, and not like an external tool (meaning that it wouldn't rely on a third party build chain, Less.js would do all the work)?
stevenvachon commentedon Mar 7, 2014
@jonschlinkert sure, but would it work with Less.js' dev mode and would it produce accurate source maps relative to the Less code and not its CSS output?
seven-phases-max commentedon Mar 7, 2014
@stevenvachon by "Less.js' dev mode" do you mean client side usage? See #1835.
jonschlinkert commentedon Mar 7, 2014
@stevenvachon well, that brings up a good point - I guess (like most things) it will depend on expectations. So maybe the first thing to do is for us to outline these things and get consensus on what the autoprefixer would be expected to do.
Then @lukeapage / @seven-phases-max can decide whether or not a plugin would work, or if it needs to be implemented natively.
jonschlinkert commentedon Mar 7, 2014
also see: https://github.com/less/less-plugins-core/blob/master/lib/auto-prefix.js
stevenvachon commentedon Mar 7, 2014
@jonschlinkert my expectations would be pretty simple:
Not sure if anyone has anything to add to that.
As to whether it should be a plugin or a native feature, I'd push for native as it maintains Less.js' ease of use and brings everything closer to achieving @mdo's summary of what a pre-processor should be.
stevenvachon commentedon Mar 7, 2014
@jonschlinkert that link you posted, does it have a reference of properties/rules that get prefixed? And, does it—should it—have a source for updates (like autoprefixer does with caniuse.com)?
23 remaining items
stevenvachon commentedon Sep 11, 2014
Along with this, why not just include Myth as a possible post-processor option? Excessive?
seven-phases-max commentedon Sep 11, 2014
@stevenvachon If I understand it correctly the agreement is to provide whatever post-preprocessing via plugins and not as a dedicated core-options. (I.e. to add
autoprefixerormythor anything you just write a plugin which registers itself as a postprocessor and applies desired transformations to the output CSS). In other words it looks like we're building mini-grunt here 🚲 :)stevenvachon commentedon Sep 11, 2014
Ah, yeah, I prefer that approach. And, haha, I don't use task runners as much anymore; maybe others are doing the same?
seven-phases-max commentedon Sep 11, 2014
You will then.
lessc/less.jsbecomes a task-runner as soon as you put all that stuff in. So it's just a matter of naming things by their true names w/o getting shy ;)stevenvachon commentedon Sep 11, 2014
What I mean is that I don't use Grunt/Gulp much anymore. Lately, I've just been using npm-scripts and a build.js with each lib's programmatic API.
seven-phases-max commentedon Sep 11, 2014
Yes, I've got it above. I mean it does not matter how the thing is named:
gulp,grunt,build.js,build.bat,build.sh,lessc(with all stuff inside), in general it's all the same "build chain" essentially.stevenvachon commentedon Sep 12, 2014
A plugin architecture may not even be necessary if we have a callback that supports a
Promise. Can avoid becoming a mini task runner.seven-phases-max commentedon Sep 12, 2014
A callback also may be not necessary since
less.render"returns" a CSS string one can do everything with he wants to.These ("external tool wrapper") plugins are still necessary only because they'll keep asking for a monolith tool no matter what.
lukeapage commentedon Sep 12, 2014
(maybe you knew but) less.render returns a promise on v2 if no callback is
specified.
seven-phases-max commentedon Sep 12, 2014
Yes, my bad, I guess just overgeneralized things a bit to not confuse even more :) (In other words, the real purpose of the callback and/or promise there is that it can make async things more simple and/or make error handling more easy... If that would not be necessary it could just really return a string and never care of anything that happens after that (if it could be "just" Less compiler :).)
lukeapage commentedon Sep 12, 2014
No problem, I was actually replying to Steve!
stevenvachon commentedon Sep 12, 2014
😄 I hadn't checked much of the source before saying that. Most everything seems to have been thought of, which is awesome.
lukeapage commentedon Oct 19, 2014
less-plugin-autoprefix is now on npm and works with the (just release) beta v2 of lessc. I've started mentioning autoprefixer in the docs and I hope more people take advantage of how easy it is to use now, even without a build process.