Skip to content

Extract CSS Optimizer #102

Closed
Closed

Description

@Filirom1

Hi James,

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.

This is something I tried and it works great with NodeJS : http://github.com/Filirom1/h5bp-build-script-tags/blob/master/lib/utils/minifyCss.js

If you are agree with this idea, I am willing to help.

Cheers
Romain

Activity

  1. jrburke commented on Feb 16, 2012

    @jrburke
    Member

    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.

  2. Filirom1 commented on Feb 17, 2012

    @Filirom1
    Author

    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.

  3. jrburke commented on Mar 5, 2012

    @jrburke
    Member

    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.

  4. Filirom1 commented on Mar 5, 2012

    @Filirom1
    Author

    Great news :)

  5. jrburke commented on May 25, 2012

    @jrburke
    Member

    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.

  6. ryanfitzer commented on Mar 20, 2013

    @ryanfitzer

    @Filirom1 I have made some progress on this with CSSCat. Please see issue #167 for more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions