Created
May 28, 2010 05:36
-
-
Save chriseppstein/416803 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
compressed: false | |
--- | |
// Put this file in your javascripts directory | |
// Iterate over the items in the project and concatenate the javascripts that are marked for compression. | |
<% for js_item in @items.select {|i| i.identifier =~ %r{^/javascripts/}} -%> | |
<% next unless js_item.attributes.fetch(:compressed, true) -%> | |
<%= js_item.rep_named(:default).compiled_content %> | |
<% end -%> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't compile the javascripts | |
compile '/javascripts/*/' do | |
nil | |
end | |
# Don't route the javascript that is compressed, | |
# otherwise route to a js file instead of an index.html | |
route '/javascripts/*/' do | |
if item[:compressed] | |
nil | |
else | |
item.identifier.chop+".js" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment