Skip to content

Instantly share code, notes, and snippets.

@tomraithel
Forked from wolfeidau/sass_converter.rb
Created November 12, 2012 09:52
Show Gist options
  • Save tomraithel/4058424 to your computer and use it in GitHub Desktop.
Save tomraithel/4058424 to your computer and use it in GitHub Desktop.
Sass plugin for Jekyll
module Jekyll
# Sass plugin to convert .scss to .css
#
# Note: This is configured to use the new css like syntax available in sass.
require 'sass'
class SassConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /scss/i
end
def output_ext(ext)
".css"
end
def convert(content)
begin
puts "Performing Sass Conversion."
engine = Sass::Engine.new(content, :syntax => :scss, :load_paths => ["./css/"])
engine.render
rescue StandardError => e
error = "!!! SASS Error: #{e.message} !!!"
puts error
"body:before{ content:\"#{error}\"; color: red; font-size: 20px; }"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment