Skip to content

Commit

Permalink
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -89,6 +89,9 @@
* Implemented some `Enumerable` methods: `#collect_concat`, `#flat_map`,
`#reject`, `#reverse_each`, `#partition` and `#zip`.

* Support any Tilt template for `index_path` in `Opal::Server`. All index
files are now run through `Tilt` (now supports haml etc).

## 0.5.5 2013-11-25

* Fix regression: add `%i[foo bar]` style words back to lexer
File renamed without changes.
18 changes: 10 additions & 8 deletions lib/opal/sprockets/server.rb
Original file line number Diff line number Diff line change
@@ -112,18 +112,20 @@ def call(env)

# Returns the html content for the root path. Supports ERB
def html
source = if @index_path
if @index_path
raise "index does not exist: #{@index_path}" unless File.exist?(@index_path)
File.read @index_path
elsif File.exist? 'index.html'
File.read 'index.html'
elsif File.exist? 'index.html.erb'
File.read 'index.html.erb'
Tilt.new(@index_path).render(self)
elsif index = search_html_path
Tilt.new(index).render(self)
else
SOURCE
::ERB.new(SOURCE).result binding
end
end

::ERB.new(source).result binding
def search_html_path
%w[index.html index.html.haml index.html.erb].find do |path|
File.exist? path
end
end

def javascript_include_tag source

0 comments on commit cfc5028

Please sign in to comment.