Tag cloud
See my latest projects
About this site
This site is proudly powered by WordPress. If you like what you see, why not subscribe?
Copyright © 2008-2010 Aaron Russell. All rights reserved.
Wednesday, 23 December 2009

The problem with CSS pre-processing frameworks is that they don’t really fit within the average web designers’ work flow. Or they don’t mine, anyway.
Having to compile and recompile at every iteration is just a pain in the backside, it’s not the way I work. I like to make some tweaks, view them in the browser, make more tweaks, view them in the browser, and repeat.
When you add in to that the process of going to the command line and recompiling, all of a sudden writing CSS becomes a dull slog. Not the way I like to work.
The other problem is that pre-processing frameworks are normally deeply entrenched in a particular technology, such as SASS and LESS being Ruby tools.
This is fine if you’re developing CSS within your web application, but that’s not the way I work. I like to build all my HTML and CSS assets way before I go anywhere near firing up the web app – I build simple static assets that I use later.
There are a few tools out there to help this problem with regards to SASS. My favourite is StaticMatic and there is also the popular Compass. However, my new CSS framework of choice, LESS, has fewer tools available to assist.
Yesterday afternoon I wanted to demo some LESS-based work to a client. It needed some basic dynamic functionality, but I didn’t want to faff around with setting up a Ruby project. PHP would do the trick so I needed LESS to work within PHP.
So, I spent a few hours bashing together the LESS PHP Cacher.
OK, lets be clear, this is NOT a PHP port of LESS. I’ll leave that joyous-sounding task to someone with far more PHP wizardry skills (and time on their hands) than me.
Therefore, you still need Ruby in order to install the LESS and LESS PHP Cacher gems.
First of all it installs a command line tool on your system. Using the command line tool installs a simple PHP wrapper script in to your web project.
Now you just write all your stylesheets using LESS. When you view the site in a browser, the PHP wrapper script invokes the LESS engine to parse the LESS into CSS and it creates a cached version.
That’s it.
In truth it doesn’t do a hell of a lot more than just leaving the normal LESS command line tool running in watch mode. The only difference is that you don’t have to worry about starting up daemons, you can work on multiple LESS files at once, and it might be a little bit more friendly to non-Rubyists.
The other plus point is that you can, in theory, put this on your production environment – providing you have access to the command line and can install Ruby Gems.
Whether or not you’d actually want to do that I’m not sure. I built this primarily as a development tool for my own specific needs.
As with all Ruby Gems, installation is easy:
sudo gem install less_php_cacher
It requires LESS (obviously) so make sure that’s installed too.
Hop into your command prompt and go to the root of your existing web project. Then simply type:
lessphpc prepare
That creates the PHP wrapper script (called less.php) and a cache directory.
Write your LESS-based stylesheets and save them where-ever you like within your web project. Then reference them in your source code by either:
<link rel="stylesheet" href="less.php?style.less" type="text/css">
..or..
<?php include 'less.php'; ?>
<style type="text/css">
<?php less_php('style.less'); ?>
</style>
Usual stuff – this is the result of only a few hours bodging about, and not at all tested other than on my own Mac. Mileage may vary.
That said, feel free to let me know how it goes – any problems you encounter or any new features you’re like to see included.
So, you want cross-browser RGBa support, huh? Well, now you can with my new Compass plugin, rgbapng. Read on to find out more.
As web standards evangelists fall over themselves to point out the hypocrisy of Apple’s Safari-only HTML5 web-standards showcase, I wonder if the liberal use of the term HTML5 means something else?
Today I released a new jQuery plugin called Smart Ass Login Values. It’s a plugin for adding default values to login form fields – like in situations where there can be no text label.
What can only be described as an ee-shit-storm kicked off today, when an ExpressionEngine developer called Alex Gordon released a forked version of the popular EE extension, FF Matrix.
Yesterday Microsoft released to the world a platform preview of IE9. I’m sure you’ve read all about it by now, so what do we all think?
“RT @albertlo: Checking out AirDropper that lets Dropbox users securely requests files from anyone, looking very useful: http://bit.ly/dxKcob”
Posted about 1 hour ago.
This site is proudly powered by WordPress. If you like what you see, why not subscribe?
Copyright © 2008-2010 Aaron Russell. All rights reserved.