compress CSS

Discussion in 'Ruby' started by Chris Gallagher, Feb 15, 2007.

  1. Hi,

    Does anyone know of any script that can be used to compress css for
    deployment. Im looking for something that can be used during the build
    process rather than something you click to acheive it. Were currently
    using jsmin for javascript, something like that for css would be ideal.

    cheers,

    Chris

    --
    Posted via http://www.ruby-forum.com/.
     
    Chris Gallagher, Feb 15, 2007
    #1
    1. Advertising

  2. Hi,

    Have you looked at CSSTidy?

    I'm thinking of using it myself, but I don't have any experience with it

    Kev
     
    Kevin Jackson, Feb 15, 2007
    #2
    1. Advertising

  3. Hi Kevin,

    Looks like an interesting project. I'll have a look at it. I think i
    might be looking for something more script based though. Ive found a
    couple of python alternatives out there but i'd much rather use ruby


    Kevin Jackson wrote:
    > Hi,
    >
    > Have you looked at CSSTidy?
    >
    > I'm thinking of using it myself, but I don't have any experience with it
    >
    > Kev



    --
    Posted via http://www.ruby-forum.com/.
     
    Chris Gallagher, Feb 15, 2007
    #3
  4. As it's c++ (ie native), you can add it to your rake/rant build as a
    callout with ` - then you can keep your build ruby based

    Also as it's open source, if you really wanted you could rewrite in ruby

    Kev
     
    Kevin Jackson, Feb 15, 2007
    #4
  5. Chris Gallagher wrote:
    > Does anyone know of any script that can be used to compress css for
    > deployment. Im looking for something that can be used during the build
    > process rather than something you click to acheive it. Were currently
    > using jsmin for javascript, something like that for css would be ideal.


    gzip

    Seriously, most browsers accept gzip compression so if you want to save
    bandwidth, the best option is to have a .gz version of each css file and
    send that if the browser supports gzip encoding. This is what I do for
    my css and javascript files:
    ReWriteCond %{HTTP:accept-encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}$1.gz -f
    RewriteRule ^(.+)$ $1.gz [passthrough,last]

    Daniel
     
    Daniel DeLorme, Feb 15, 2007
    #5
  6. Chris Gallagher, Feb 15, 2007
    #6
  7. Chris Gallagher

    Tom Copeland Guest

    On Thu, 2007-02-15 at 20:40 +0900, Daniel DeLorme wrote:
    > Chris Gallagher wrote:
    > > Does anyone know of any script that can be used to compress css for
    > > deployment. Im looking for something that can be used during the build
    > > process rather than something you click to acheive it. Were currently
    > > using jsmin for javascript, something like that for css would be ideal.

    >
    > gzip
    >
    > Seriously, most browsers accept gzip compression so if you want to save
    > bandwidth, the best option is to have a .gz version of each css file and
    > send that if the browser supports gzip encoding. This is what I do for
    > my css and javascript files:
    > ReWriteCond %{HTTP:accept-encoding} gzip
    > RewriteCond %{DOCUMENT_ROOT}$1.gz -f
    > RewriteRule ^(.+)$ $1.gz [passthrough,last]


    Or you can use mod_deflate; then you don't need to provide a gzip'd
    version. Of course, that will cost some server CPU time, so it's a
    tradeoff...

    Yours,

    Tom
     
    Tom Copeland, Feb 15, 2007
    #7
  8. Chris Gallagher

    glenn Guest

    > Does anyone know of any script that can be used to compress css for
    > deployment. Im looking for something that can be used during the build
    > process rather than something you click to acheive it. Were currently
    > using jsmin for javascript, something like that for css would be ideal.
    >
    > cheers,


    I've been working on a completely unrelated project but with code that
    I could fairly quickly customise to meet this requirement. I'll try to
    knock it up over the weekend. Simply require whatever the plugin/gem
    is and call stylesheet_include_tag as per normal and it would
    automatically process at run-time. Need to consider how to do the
    cleanup after a file changes though.

    Glenn
     
    glenn, Feb 16, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony
    Replies:
    0
    Views:
    1,484
  2. ixtahdoom
    Replies:
    0
    Views:
    573
    ixtahdoom
    Jun 15, 2004
  3. Martin

    Compress ASP.NET Pages

    Martin, Oct 23, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    670
  4. ad
    Replies:
    1
    Views:
    489
    Cowboy \(Gregory A. Beamer\)
    Mar 6, 2005
  5. ad
    Replies:
    2
    Views:
    1,266
    Cowboy \(Gregory A. Beamer\)
    Mar 6, 2005
Loading...

Share This Page