Skip to content

Commit

Permalink
Merge pull request #2739 from DynamicDyno/sassify-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Aug 13, 2014
2 parents 2b81e5e + 566d371 commit fac5a2e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/jekyll/filters.rb
Expand Up @@ -25,6 +25,28 @@ def markdownify(input)
converter.convert(input)
end

# Convert a Sass string into CSS output.
#
# input - The Sass String to convert.
#
# Returns the CSS formatted String.
def sassify(input)
site = @context.registers[:site]
converter = site.getConverterImpl(Jekyll::Converters::Sass)
converter.convert(input)
end

# Convert a Scss string into CSS output.
#
# input - The Scss String to convert.
#
# Returns the CSS formatted String.
def scssify(input)
site = @context.registers[:site]
converter = site.getConverterImpl(Jekyll::Converters::Scss)
converter.convert(input)
end

# Format a date in short format e.g. "27 Jan 2011".
#
# date - the Time to format.
Expand Down
8 changes: 8 additions & 0 deletions test/test_filters.rb
Expand Up @@ -34,6 +34,14 @@ def initialize(opts = {})
assert_equal "<p>something <strong>really</strong> simple</p>\n", @filter.markdownify("something **really** simple")
end

should "sassify with simple string" do
assert_equal "p {\n color: #123456; }\n", @filter.sassify("$blue:#123456\np\n color: $blue")
end

should "scssify with simple string" do
assert_equal "p {\n color: #123456; }\n", @filter.scssify("$blue:#123456; p{color: $blue}")
end

should "convert array to sentence string with no args" do
assert_equal "", @filter.array_to_sentence_string([])
end
Expand Down

0 comments on commit fac5a2e

Please sign in to comment.