Permalink
Browse files

Allow assets to be precompiled

  • Loading branch information...
1 parent 91049d5 commit 61b4f501ed2475d0c9e330cd28e41d6c43d90e59 @peteog committed Dec 15, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/sinatra/simple_assets.rb
@@ -64,6 +64,12 @@ def combined
def path
@type == :js ? 'javascripts' : 'stylesheets'
end
+
+ def compile
+ File.open("#{@root}/#{hashed_path}", 'w') do |f|
+ f << content
+ end
+ end
end
class Assets
@@ -103,6 +109,12 @@ def content_for(bundle)
bundle = @bundles[@hashes[bundle]]
bundle.content if bundle
end
+
+ def precompile
+ @bundles.values.each do |bundle|
+ bundle.compile
+ end
+ end
end
def assets(&block)

0 comments on commit 61b4f50

Please sign in to comment.