public
Description: Automatic inclusion of browser and OS-specific stylesheets with a simple naming convention.
Homepage: http://www.mbleigh.com/plugins/browserized-styles-dead-simple-browser-specific-styling
Clone URL: git://github.com/mbleigh/browserized-styles.git
100644 63 lines (42 sloc) 2.208 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
== BrowserizedStyles ==
 
Browserized Styles provides a dead simple way to create browser and operating sytem-specific
CSS code for use in a Rails application. All you need to do is create a .css file targeted to
a browser by appending an underscore and identifiers to the end.
 
=== Installation ===
 
script/plugin install git://github.com/mbleigh/browserized-styles.git
 
=== Example ===
 
Let's say I have some complex CSS code that looks bad in some browsers, but works in
others. Let's also say that i've put it into a stylesheet in stylesheets/complex.css.
 
My stylesheet link tag looks something like this:
 
<%= stylesheet_link_tag 'complex' %>
 
Now all I have to do to target a browser is create a new CSS file with the browser's
identifier appended to it with an underscore (e.g. "complex_ie6.css"). That's it!
The same exact stylesheet link tag will automatically check the current user
agent and load a browser-specific CSS file if it exists. Ta-da! One-step browser
styles!
 
=== Identifiers ===
 
Browsers and OS's are identified as following. You would create the CSS file as
"yourcssfile_browsername.css" or "yourcssfile_osname" or "yourcssfile_browsername_osname"
 
==== Browsers ====
 
IE6: ie6
IE7: ie7
Opera: opera
Firefox: gecko
Safari: safari
Konqueror: konqueror
 
==== Operating Systems ====
 
Mac OS (X or prior): mac
Windows (any): win
Linux: linux
 
=== Limitations and Caveats ===
 
At this time the plugin is only designed to work with .css files in your stylesheets
directory. It will not work at present with URL-based stylesheets or stylesheets not
found in your stylesheets directory (or some subdirectory thereof).
 
At the moment, stylesheets are included in this order: original, browser-specific,
os-specific, browser-and-os-specific. This is logically from least to most specific,
but if you need a different order you will have to hack it manually.
 
=== Resources ===
 
Blog Article: http://www.intridea.com/2007/12/9/announcing-browserized-styles
Trac: http://trac.intridea.com/trac/public/
SVN: script/plugin install http://svn.intridea.com/svn/public/browserized_styles
 
Copyright (c) 2007 Michael Bleigh and Intridea, Inc., released under the MIT license