CSSRule.cfc - ColdFusion CSS Rule Parsing

The CSSRule.cfc is a ColdFusion component that can parse and model CSS using ColdFusion. I love CSS; I think it's like the most awesome, straightforward way to describe formatting of rendered boxes. As such, I wanted to use it in more of my projects. However, in order to do this, I needed to come up with a way to parse and maintain the CSS model programmatically inside of ColdFusion.

Features

  • Models a large sub-set of CSS properties (not including auditory features)
  • Can handle short-hand notation (ex. font, background)
  • Can return a single property or the entire map of properties

Known Bugs And Issues

  • Some CSS rules not supported

Downloads

Build 2008/03/20

Added three methods:

  • AppendCSSRule( CSSRule ) - This takes one CSSRule.cfc instance and adds its properties to the current CSSRule.cfc instance. It will only overwrite properties that have a value (will not copy over empty string values). This gives the passed-in instance a higher cascading precedence.
  • GetRuleString( [IncludeEmptyValues] ) - Converts the CSSRule.cfc property map into style-type attribute values (property = value ; property = value ;).
  • PrependCSSRule( CSSRule ) - This is a lot like the AppendCSSRule() method, but it treats the cascading in a reverse fashion. This takes one CSSRule.cfc instance and adds its properties to the current CSSRule.cfc instance, but, it only adds the new property value if that property is not already defined in the current property map. This gives the current instance a higher cascading precedence.

Added the following property support:

  • Color

Build 2008/02/05

This build comes with a small example for setting CSS and getting the property map.

  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools