Fixes for Sass/SCSS converters.

This commit is contained in:
Parker Moore 2014-01-12 02:18:59 -08:00
parent 824a84ef2a
commit 4da7223831
4 changed files with 45 additions and 4 deletions

View File

@ -12,7 +12,7 @@ module Jekyll
end
def convert(content)
Sass.compile(content, :syntax => :sass)
Object::Sass.compile(content, :syntax => :sass)
end
end
end

View File

@ -1,10 +1,10 @@
module Jekyll
class Sass < Converter
class Scss < Converter
safe true
priority :low
def matches(ext)
ext =~ /^\.sass$/i
ext =~ /^\.scss$/i
end
def output_ext(ext)
@ -12,7 +12,7 @@ module Jekyll
end
def convert(content)
Sass.compile(content, :syntax => :scss)
::Sass.compile(content, :syntax => :scss)
end
end
end

20
test/test_sass.rb Normal file
View File

@ -0,0 +1,20 @@
require 'helper'
class TestSass < Test::Unit::TestCase
context "converting sass" do
setup do
@content = <<-SASS
$font-stack: Helvetica, sans-serif
body
font-family: $font-stack
font-color: fuschia
SASS
@output = <<-CSS
body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; }
CSS
end
should "produce CSS" do
assert_equal @output, Jekyll::Sass.new.convert(@content)
end
end
end

21
test/test_scss.rb Normal file
View File

@ -0,0 +1,21 @@
require 'helper'
class TestSass < Test::Unit::TestCase
context "converting SCSS" do
setup do
@content = <<-SCSS
$font-stack: Helvetica, sans-serif;
body {
font-family: $font-stack;
font-color: fuschia;
}
SCSS
@output = <<-CSS
body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; }
CSS
end
should "produce CSS" do
assert_equal @output, Jekyll::Scss.new.convert(@content)
end
end
end