XCSS Parser
Working with CSS can be painful at times, and while there is the option of switching to SASS or similar I personally find these more even more annoying. Being able to quickly preview your work is useful.
CSS does actually have a few built in constructs to break up work better @import
does allow you to split up multiple files although this is not recommended for a production site as it increases the number HTTP requests.
My simple solution is a python app that will take your CSS files and combine them into a single file, at the same time removing any blank lines, this is not as advanced as a CSS minification tool but does a similar job. Combined with gzip compression on the server side for best results.
My biggest dislike with SASS and co is that the syntax is quite different from standard CSS, this means you cannot preview the output in your browser without a compile stage, slowing down the development workflow. My solution (thus far) does not introduce anything that is not supported already by your browser.
The only feature I added (which is entirely optional) is support for variables, again I wanted to ensure that the syntax is as similar as possible to standard CSS (they actually work more like a Make MACRO). A variable is defined using @define NAME VALUE;
and can then be referenced with $NAME
.
Anyway if your interested check out the project on BitBucket:
https://bitbucket.org/timsavage/xcss-parser/overview
- Posted in: Development ♦ Python
- Tagged: css, python, web development