Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Jul 10, 2011
1 parent a39f43d commit d70b5cb
Show file tree
Hide file tree
Showing 2 changed files with 690 additions and 238 deletions.
20 changes: 17 additions & 3 deletions lib/sinatra_boilerplate.rb
Expand Up @@ -31,10 +31,14 @@ def javascript_assets
settings.js_assets
end

def javascript_includes_names
if settings.production? then %w[/all.js]
else javascript_assets.map {|f| "/#{File.basename(f, '.*')}.js" }
end
end

def javascript_includes
if settings.production? then %w[all.js]
else javascript_assets.map {|f| File.basename(f, '.*') + '.js' }
end.map {|a| %(<script src="/#{a}"></script>) }.join("\n")
javascript_includes_names.map {|a| %(<script src="#{a}"></script>) }.join("\n")
end

def javascript_files
Expand Down Expand Up @@ -87,4 +91,14 @@ def self.registered(app)
end
end

# monkeypatch to Tilt to enable rendering coffeescript with multibyte
# characters in it
Tilt::CoffeeScriptTemplate.class_eval do
alias original_prepare prepare
def prepare
original_prepare
data.force_encoding @default_encoding
end
end

Sinatra.register SinatraBoilerplate

0 comments on commit d70b5cb

Please sign in to comment.