-
Notifications
You must be signed in to change notification settings - Fork 2
CSS Inlining
MadRabbit edited this page Sep 13, 2010
·
1 revision
With the tool you can convert your css source in some javascript
definition so you could put the styles in the same file as your
javascript and have -1 (or several) hits to your sever.
File('public/javascripts/all_in_one.js', 'w') do |file|
file.write @c.compact_files(%w{
public/javascripts/prototype.js
public/javascripts/effects.js
public/javascripts/application.js
})
file.write @c.inline(
File.open(‘public/stylesheets/application.css’).read
)
end
Now you have a single javascript file which contains both, javascript
and the application stylesheets in one.
NOTE: if the user have JavaScript switched off, then he won’t see the
styles.