CSS Coding Standards
TWiki should define
CodingStandards parameters - e.g. that the
CSS should/should not be compressed, or that there's a compilation step such that developers work with a source that is compiled before being delivered in the skin.
Tools:
--
Contributors: MartinCleaver, --
ArthurClemens
Discussion
--
MartinCleaver - 06 Jun 2006
I am seeing the benefits of small compressed css as well. I am just using
http://www.cleancss.com/
(
CSS compressor) now to compress pattern skin css. These files will live along the uncompressed files.
For compressed files I use the name pattern
sheetname.compressed.css, for instance
style.compressed.css. If a stylesheet is updated, the compressed version should be updated as well. A minor hassle, if you see the space gain. Of course, with pattern skin you can simple point the
TWIKILAYOUTURL variable to the new compressed version, or to the original version when debugging.
The same goes for compressed javascript, for which I am using
Dojo's ShrinkSafe
to generate
twiki.compressed.js and so on.
So yes, to outline a standard:
- All css files are kept in their uncompressed format, to support refactoring and debugging, so preferably with comments
- Compressed css files may be distributed as
sheetname.compressed.css, as long as both versions are kept up to date (fully or semi-automatic)
--
ArthurClemens - 06 Jun 2006
Did you measure any performance gain Arthur? (I am asking only out of interest.)
--
KennethLavrsen - 07 Jun 2006
No, I haven't measured. I have only looked at filesizes, and these are about 30% smaller.
--
ArthurClemens - 07 Jun 2006
Changed topic name from TidyCSS to CssCodingStandards.
--
ArthurClemens - 07 Jun 2006