. . . interpreting the deafening silence as acute anticipation. . .
8-)
> I plan to post my intended matrix of Sass $variables vs stylesheets - very much a work in progress
So here it is:
http://spreadsheets.google.com/pub?key=t83v_WZhnp_F1w-vyaOvdFQ&single=true&gid=0&output=html
For posterity's sake, in case the above disappears, there's a text
record of my .scss file headers at the bottom of this message.
-----------------------------------------------
Here are a couple of Sass snippets to demonstrate the use of @if to
classify which rules go to which stylesheets. Note I've defaulted to
start with making each "flavor" pretty well self-documenting, showing
the (locally irrelevant) alternative code commented out, except where
the redundancy would be ridiculous. Since I use minifiers that strip
out all comments before rolling out a new design version from dev to
public, these won't impact served file weights.
Standalone declaration
<code>
@if $moz and ($invalid == true) {
/* For Gecko only - not valid. */
button::-moz-focus-inner { border: 0; }
}
@else {
/* For Gecko only - not valid. */
/* button::-moz-focus-inner { border: 0; } */
}
</code>
Within a ruleset:
<code>
//-------------------------------------- - - - - - -
// originally:
// margin: 0.8em 0 0;
// *margin: 1.75em 0 0;
//-------------------------------------- - - - - - -
@if $ie6-7 and $invalid {
/* For IE 6 & 7 only. */
margin: 1.75em 0 0;
/* For all but IE 6 & 7. */
/* margin: 0.8em 0 0; */
/* For all. */
}
@if not $ie6-7 {
/* For IE 6 & 7 only. */
/* margin: 1.75em 0 0; */
/* For all but IE 6 & 7. */
margin: 0.8em 0 0;
/* For all. */
}
@if not $invalid {
/* For IE 6 & 7 only. */
margin: 1.75em 0 0;
/* For all but IE 6 & 7. */
margin: 0.8em 0 0;
/* For all. */
}
// strange how this doesn't work - posted an issue
/* For all. */
padding: 0 0.5em;
</code>
Sample mixin - something like this probably already exists within
Compass' native libraries, sorry I didn't check them out first
<code>
@mixin css3-border-box {
@if $ie6-7 and $invalid {
/* For IE 6 and up only - not valid. */
-ms-box-sizing: border-box;
/* For `other` browsers - not valid CSS 2.1 - yes valid CSS3. */
/* box-sizing: border-box; */
}
@if $ie8-up and $invalid {
/* For IE 6 and up only - not valid. */
-ms-box-sizing: border-box;
}
@if $moz and $invalid {
/* For Gecko only - not valid. */
-moz-box-sizing: border-box;
}
@if $webkit and $invalid {
/* For Webkit only - not valid. */
-webkit-box-sizing: border-box;
}
@if $css3 and $invalid {
/* For `other` browsers - not valid CSS 2.1 - yes valid CSS3. */
box-sizing: border-box;
}
@if not $invalid {
/* For `other` browsers - not valid CSS 2.1 - yes valid CSS3. */
/* box-sizing: border-box; */
}
}
</code>
-----------------------------------------------
Implementation details:
Development efficiency:
This methodology wouldn't be at all practical without using a decent
diff'ing tool. For those otherwise pitiable users stuck on windoze,
this is one niche where the platform offers a superior tool - I highly
recommend Winmerge. And personally I'd never work without version
control, even when flying solo.
Browser detection:
I've decided to implement the "browser sniffing" with enhance.js,
which actually uses feature detection to classify UA's into "good/
modern" browsers vs "old/crippled". These stylesheets listed here only
go to Grade A UAs, while a LITE.CSS delivers a simplified single-
column fluid design suitable for older handhelds, IE5 et al. Obviously
UA's without CSS capabilities get POSH.
The performance advantage of further engine-specific browser detection
(UA string sniffing is SO first-decade) would be pretty minor.
Therefore, out of this "Grade A / Full view" group, the only files I'm
currently planning to actually serve are IE6-7.CSS and SCREEN.CSS -
but the capability is there for those using a more traditional
browsers detection routine.
VALID.CSS is only for running through W3's validation service (good
for catching typos and missed hacks).
Future enhancements:
Within my "Full" design I plan to detect the viewport width and swap
out different versions of the layout accordingly; but that's
definitely Stage 2 for now.
iOS-targeting is left as an exercise for the reader (hint: don't use
media=handheld).
===============================================
Following redundant information for archive backup purposes only:
<code>
// IE6-7.CSS: $invalid: true; | $css3: false; | $ie6-7: true;
// $ie8-up: false; | $moz: false; | $webkit: false; |
$opera: false;
//
// SCREEN.CSS: $invalid: true; | $css3: true; | $ie6-7: false;
// $ie8-up: true; | $moz: true; | $webkit: true; |
$opera: true;
//
// VALID.CSS: $invalid: false; | $css3: false; | $ie6-7: true;
// $ie8-up: true; | $moz: true; | $webkit: true; |
$opera: true;
//
// IE8-UP.CSS $invalid: true; | $css3: true; | $ie6-7: false;
// $ie8-up: true; | $moz: false; | $webkit: false; |
$opera: false;
//
// GECKO.CSS. $invalid: true; | $css3: true; | $ie6-7: false;
// $ie8-up: false; | $moz: true; | $webkit: false; |
$opera: false;
//
// WEBKIT.CSS: $invalid: true; | $css3: true; | $ie6-7: false;
// $ie8-up: false; | $moz: false; | $webkit: true; |
$opera: false;
//
// OPERA.CSS: $invalid: true; | $css3: true; | $ie6-7: false;
// $ie8-up: false; | $moz: false; | $webkit: false; |
$opera: true;
</code>