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
Recently I had to optimize different CSS files on an non AMD project and RequireJS optimizer just works great for this job.
But I think this code is great enough to have its own repository. In so doing, everybody could benefit from your css optimiser event if they don't use an AMD project.
r.js can be used to optimize just one CSS file. Is that enough? I feel that cssmin might be better for folks that just want css by itself and not pick up r.js in whole.
OK, if cssmin does not do import inlining, I can see this as being useful as a stand-alone thing. I would like to see happen in the 1.1 timeframe, so marking the milestone as such.
In particular, it would be good to resolve #117 and #121 before attempting the break-out.
Also, I would structure the breakout project to use amdefine and provide the module in a define-wrapped form. This will make it easier to consume in r.js.
Looking more at this, it has some dependencies on the env/file module, so that it can run in both rhino and node, so I'm not sure how to break it out.
One way would be to just build an adapter module that just uses requirejs as a dependency, then uses the useLib method to load the optimize module and call just the optimize CSS stuff. Here is an example that does that for the 'parse' module:
So I'm going to close this as something I am not sure how to do in a way that makes it easy also to use in rhino and as part of requirejs, at least a way that is worth the effort involved. The "make a package that uses requirejs as a dependency and exposes a different, focused API to the CSS part" might work out, but I will not be doing this.
We can still talk more about it in this ticket though, if you see a way to do it.
Activity
jrburke commentedon Feb 16, 2012
r.js can be used to optimize just one CSS file. Is that enough? I feel that cssmin might be better for folks that just want css by itself and not pick up r.js in whole.
Filirom1 commentedon Feb 17, 2012
Are you talking about this cssmin ?
It doesn't handle css imports.
I search for other css optimizers but found nothing that's worth r.js.
I am quite reluctant to use the whole r.js, because what I really use is under 200 loc.
That's why I choose to extract the CSS optimizer.
The CSS optimizer of r.js is great enough to exist a standalone project.
jrburke commentedon Mar 5, 2012
OK, if cssmin does not do import inlining, I can see this as being useful as a stand-alone thing. I would like to see happen in the 1.1 timeframe, so marking the milestone as such.
In particular, it would be good to resolve #117 and #121 before attempting the break-out.
Also, I would structure the breakout project to use amdefine and provide the module in a define-wrapped form. This will make it easier to consume in r.js.
Filirom1 commentedon Mar 5, 2012
Great news :)
jrburke commentedon May 25, 2012
Looking more at this, it has some dependencies on the env/file module, so that it can run in both rhino and node, so I'm not sure how to break it out.
One way would be to just build an adapter module that just uses requirejs as a dependency, then uses the useLib method to load the optimize module and call just the optimize CSS stuff. Here is an example that does that for the 'parse' module:
https://github.com/jrburke/r.js/blob/master/build/tests/tools/uselib/parseDeps.js
So I'm going to close this as something I am not sure how to do in a way that makes it easy also to use in rhino and as part of requirejs, at least a way that is worth the effort involved. The "make a package that uses requirejs as a dependency and exposes a different, focused API to the CSS part" might work out, but I will not be doing this.
We can still talk more about it in this ticket though, if you see a way to do it.
ryanfitzer commentedon Mar 20, 2013
@Filirom1 I have made some progress on this with CSSCat. Please see issue #167 for more discussion.