This plugin automatically stores a copy of your style sheet(s) as a static file. Static files are served several orders of magnitude faster than PHP files (200 times faster, in my own tests on a FastCGI-based server).
Post-installation steps:
- Visit the advanced preferences and make sure the “Style directory” preference contains the directory where you want to store the static CSS files. This path is always a relative path (to the directory of your root textpattern installation). You should make sure that PHP is able to write to that directory.
- Activate the plugin.
The <txp:rvm_css />
tag supplied by this plugin has the exact same attributes as the built-in <txp:css />
tag and can be used as a drop-in replacement, but you shouldn’t have to use it, because this plugin overrides the default behaviour of the <txp:css>
tag.
Note: because not all characters are allowed in filenames, avoid using non-alphanumeric characters in style sheet names.
If you wish to use LESS syntax in your stylesheets, you need to do the following (this could be implemented as a plugin):
- Download the file lessc.inc.php (version 0.3.5 or higher) from the lessphp website and upload it to your website.
- Edit your config.php file and add this just below the ‘$txpcfg’ configuration lines:
require '/path/to/lessc.inc.php';
Things you should know when using LESS syntax:
- Remember to save each style sheet anew each time you update the lesssc.inc.php file.
- If your LESS code cannot be parsed, an error will be shown at the bottom of css admin tab and the static css file will not be updated.
- When specifying only the filename in an “@import ‘style.less’” statement, the plugin assumes it’s in the “Style directory”. Do not leave out the ‘.less’ extension!