Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Created May 28, 2010 05:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriseppstein/416803 to your computer and use it in GitHub Desktop.
Save chriseppstein/416803 to your computer and use it in GitHub Desktop.
---
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 -%>
# 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