Forum: Ruby compress CSS

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
607d3eb2d8ae3d07c5075e4f56c479c2?d=identicon&s=25 Chris Gallagher (gala)
on 2007-02-15 11:22
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
9ea8a6477bb65605c85dc1db2da18864?d=identicon&s=25 Kevin Jackson (Guest)
on 2007-02-15 11:53
(Received via mailing list)
Hi,

Have you looked at CSSTidy?

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

Kev
607d3eb2d8ae3d07c5075e4f56c479c2?d=identicon&s=25 Chris Gallagher (gala)
on 2007-02-15 12:24
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
9ea8a6477bb65605c85dc1db2da18864?d=identicon&s=25 Kevin Jackson (Guest)
on 2007-02-15 12:27
(Received via mailing list)
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
E0526a6bf302e77598ef142d91bdd31c?d=identicon&s=25 Daniel DeLorme (Guest)
on 2007-02-15 12:40
(Received via mailing list)
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
607d3eb2d8ae3d07c5075e4f56c479c2?d=identicon&s=25 Chris Gallagher (gala)
on 2007-02-15 12:44
Came accross this plugin:

http://synthesis.sbecker.net/

Looks pretty cool so think i'm going with that assuming it works :-)

Thanks for the advice.

Chris
560c83ff6b6600e39315a1cf75b7c229?d=identicon&s=25 Tom Copeland (Guest)
on 2007-02-15 16:40
(Received via mailing list)
On Thu, 2007-02-15 at 20:40 +0900, Daniel DeLorme wrote:
> 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
781bda58d641b468092d36f4abda0170?d=identicon&s=25 glenn (Guest)
on 2007-02-16 13:20
(Received via mailing list)
> 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
This topic is locked and can not be replied to.