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).
- Activate the plugin.
- Create a directory for the static style sheet files in the root of your textpattern installation. You should make sure that PHP is able to write to that directory.
- Visit the advanced preferences and make sure the “Style directory” preference contains the directory you created in step 2. This path is always a relative path (to the directory of your root textpattern installation).
- Visit the style tab and save each of your style sheets again (saving creates the static file).
- Replace all occurrences of
<txp:css /> with
<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.
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:
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!