Jump to menu

Vote down?

  1. Monika Szczygie?

    Long time ago in a galaxy far, far away… wait, that’s a completely different story. Let’s start again: in the past millenium I used something called HSC. It was an HTML preprocessor, that gave me an idea for the solution, that works for me now.

    Needed tools:

    * SVN (or any version control system of your choice; it’s not essential, but you’ll still have to use the scripts …and after all, what sane person doesn’t use some VCS anyway?),

    * conversion table – e.g. in (keyword:value\n)* format,

    * custom commit script that runs keyword->value conversion on *.css files and then commits,

    * second script that converts value->keyword on update.

    Instead of svn commands, I use the custom scripts as Total Commander buttons or CLI commands. This way I have the keywords where I need them (my working copy) and keep the code in repository clean, so no server-side scripting is needed.

    The scripts can use local (every developer may have own keywords in her/his working copy) or global conversion table.

    You can use it for more than colours (i.e. images), but it may be not 100% update-safe.

    Of course there are some limitations:

    - you have to commit changes to see them (not a minus for me, but you may want to create a script that will export a local preview),

    - lossy conversion on update (you can’t have more than one keyword for one value),

    - you can use the keywords only in external style sheets or face a serious mess if you try to run the conversions on all files (again, not a minus for me, and in my library I have header_style() and inline_style() functions that use the global conversion table if I really, really need it; not recommended, though).

    Hope someone finds this helpful.