Hlavní menu
Nástroje |
PremekBrada.ModularCSS HistoryShow minor edits - Show changes to markup 16 November 2005, 10:16
by
- Changed lines 10-12 from:
to:
15 September 2005, 11:26
by
- Changed lines 13-14 from:
Approach Apply standard good engineering practices to CSS design and syntax. Enable and define clear consistent mapping to CSS 2.1 syntax so automated conversion is possible. to:
Approach Apply standard good engineering practices to CSS design and syntax. Enable and define clear consistent mapping to CSS 2.1 syntax so automated conversion is possible. Keep it as simple as possible. Changed lines 80-81 from:
Defines a constant token to use in rules. to:
Defines a constant token to use in rules. Token usage must not occur within the definition. Changed lines 88-90 from:
to:
// ILLEGAL: @define bodyfont(Garamond, $textfont) Changed lines 152-153 from:
Include part of stylesheet based on token value. to:
Include part of stylesheet based on token value. Conditional blocks cannot be nested. 15 September 2005, 11:23
by
- Changed lines 13-16 from:
Approach Apply standard good engineering practices to CSS design and syntax. Goal Clear consistent mapping to CSS 2.1 syntax so automated conversion is possible. to:
Approach Apply standard good engineering practices to CSS design and syntax. Enable and define clear consistent mapping to CSS 2.1 syntax so automated conversion is possible. Added lines 36-39:
Mapping: Clear -- remove "//", wrap comment in / / pair. Added lines 55-59:
Mapping: Clear: split into several rules with the same value for individual properties. Changed lines 62-65 from:
Declares that the CSS expects an URI parameter. The parameter is then used as if it was defined via @define (see below). Syntax:
@param name[(default)]
to:
Declares that the CSS expects an URI parameter. The parameter is then used as if it was defined via @define (see below). The default value must be defined for each parameter for cases when the stylesheet is not accessed by an URI. Syntax:
@param name(default)
Deleted line 69:
@param bgcol // default value undefined Added lines 73-77:
Mapping: Replace param usage ( Changed lines 95-99 from:
to:
Mapping: Replace token usage ( Changed lines 143-147 from:
to:
Mapping: Expand into a series of rules with the region name prepended to each selector. Added lines 178-181:
Mapping: Include only that part of conditional sheet for which the condition holds. 15 September 2005, 11:17
by
- Changed lines 9-10 from:
to:
15 September 2005, 11:16
by
- Changed lines 8-10 from:
to:
15 September 2005, 11:14
by
- Changed lines 7-8 from:
to:
15 September 2005, 11:10
by
- Changed lines 5-6 from:
Proposed solution Apply standard good engineering practices to CSS design and syntax. to:
References:
Proposed solutionApproach Apply standard good engineering practices to CSS design and syntax. Deleted lines 14-15:
Proposed changes15 September 2005, 11:10
by
- Added lines 7-152:
Goal Clear consistent mapping to CSS 2.1 syntax so automated conversion is possible. Proposed changesA few additional constructs to modularize the sheets:
one-line comments -- enable // comments in addition to / */ Details are listed below. One-line commentsAllow C++ style comments "from here to end of line". Syntax: @@ <text> // <comment>
Example: See the examples of other constructs below. Multi-propertiesAllow several properties to be listed in one rule. Syntax: <property>, <property>, ... : <value>
Example: // hide text by color p.invisible { background, color: white; } @paramDeclares that the CSS expects an URI parameter. The parameter is then used as if it was defined via @define (see below). Syntax: @param name[(default)]
Example: @param fg(black) // parameter 'fg' with default value 'black' @param bgcol // default value undefined /* use: style.css?fg=red&bgcol=#d0d0d0 */ @define and $valueDefines a constant token to use in rules. Syntax: @define name(value) to define, $name to use
Example: @define textfont(Times New Roman, serif) body { font-family: $textfont; // here the constant's value is substituted font-size: small; } @regionCreates a scope in the CSS that is related to a named block in HTML. The name of the region is a CSS selector consisting only of "id" or "class" HTML element attributes. Inside the @region declaration, regular rules can be used -- their selectors then apply only within the named HTML block. Region declarations cannot be nested. Syntax: @region name { <properties> <rules> }
Example: Assume the following HTML code: <div id="menu"> <ul> <li><a href="first">First option</a></li> <li><a href="second">2nd option</a></li> <li><a href="last">Last option</a></li> </ul> <ul class="admin"> <li><a href="copy">Copyright</a></li> <li><a href="mailto:addr@domain.tld">Email us</a></li> </ul> </div> Then the following CSS can be defined: @region #menu { background: silver; // these apply to the #menu DIV color: black; font-size: small; ul { margin-left: 0; } // scoped elements, as if #menu ul etc. selectors ul li { list-style: none; margin-left: 0; } } @region #menu .admin { li a, li a:visited { color: gray; } } @if blocksInclude part of stylesheet based on token value. Syntax: @if (<condition>) { <rules> } [ @elsif (<condition>) { ... } ] [ @else { ... } ] where <condition> ::= $token | $token = value | $token != value
Possible extensions to this conditional are (1) use references to properties in condition (e.g. Example: #footer { @if ($fg) { // token "fg" is defined color: $fg; } @else { color: black; } } #page { background: white; } @if ($pgborder != none) { // re-style also inner blocks if border is used #page { background: silver; border: $pgborder; } #page #menu { border: none; } } 15 September 2005, 10:23
by
- Added lines 1-10:
ModularCSS project/ideaThe problem Cascading Style Sheets are a maintainability nighmare: they badly scale for large/complex sites, they use magic values instead of constants (so double maintenance problem occurs, e.g. consistently changing trivial things like colours across the website), they don't relate to page structure. Proposed solution Apply standard good engineering practices to CSS design and syntax. Back to NametyPruzkumy (in Czech) |