I’m working on a project using Joe Workman’s Foundation theme and assorted Stacks. Running RW6 & S3. I have the consolidate CSS option enabled.
One of the CSS files “stacks_page_page19.css” publishes at about 430KB, the biggest file on the page. I use Cloudflare to auto minify CSS/JS on other sites, but I’m not using Cloudflare on this particular project.
Without using Cloudflare, can I safely use a tool like https://cssminifier.com/ to minify the CSS and then upload the file to the server overwriting the RW published CSS file? I’ve never done this before and am a bit out of my depth.
This CSS file is generated by RapidWeaver. So, after you exchanged the CSS file with a minified version, and re-publish with RapidWeaver, it is likely that the minified version gets replaced by the original one again.
But I guess the browser will cache the file after first loading, so additional requests to that page should load the CSS file from cache.
Given the caveat that @instacks mentions above (i.e. you will over write the file when republishing), there is a nice little app that is much easier to use than pasting CSS into an online minifier
You can find it here http://25.io/smaller/
Many people use this by simply exporting their sites, minifying the contents and then manually uploading via ftp. Obviously this is long winded if you are continually republishing but for a finished site it is quite a nice solution.
Perfect. So as long as I’m willing to accept the extra step, I shouldn’t have any trouble.
Thanks for your help!
Do you know if your server is set to gzip your files?? That would help decrease the size as well.
Another great idea.
I thought it was, but in checking, it isn’t. I’ll have to have my host enable.
Smaller is what I use for compiling the compressed JS files in my RapidWeaver themes. It works really well at what it does. I use it in lots of instances outside of RapidWeaver too for compressing files.
There are various ways to do this by adding a few lines to your .htaccess file (if you have one). You can also sign up (free) for CloudFlare which will compress JS and CSS. But don’t use both as minifying minified files causes pandemonium!
@peterdanckwerts I’ve only just found this thread but I was curious why you felt minifying JS & CSS in RW causes problems if you also enable it in CloudFlare? Actually I’d be interested to hear Realmac’s opinion on this as well regarding the best way forward.
Thanks for the quick answer Peter. So far it all seems fine with minify enabled both via RW and on CloudFlare but I guess logic would dictate it should be one or the other rather than both. If you look at the settings in CloudFlare it is set to “auto” minify so in theory it should only minify where necessary.
I am using Foundation and in the past problems generally occurred when I used non Foundation stacks so I am trying to limit that now and find a lot less troubleshooting that way.
I haven’t switched on CSS consolidation at the moment in RW because Foundation apparently does that already.