Skip to content

Commit

Permalink
Merge pull request #31 from fschwahn/allow_empty_template
Browse files Browse the repository at this point in the history
Don't raise error when template is empty
  • Loading branch information
bolandrm committed Jan 11, 2016
2 parents f7ff6bc + c586f05 commit ac003ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/sassc/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def initialize(template, options = {})
end

def render
return @template if @template.empty?

data_context = Native.make_data_context(@template)
context = Native.data_context_get_context(data_context)
native_options = Native.context_get_options(context)
Expand Down
5 changes: 5 additions & 0 deletions test/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@ def test_inline_source_maps
assert_match /sourceMappingURL/, output
assert_match /.foo/, output
end

def test_empty_template
output = Engine.new('').render
assert_equal '', output
end
end
end

0 comments on commit ac003ab

Please sign in to comment.