Merge pull request #2098 from jekyll/sass-as-separate-gem

This commit is contained in:
Parker Moore 2014-02-28 21:36:39 -05:00
commit f1380b6a32
4 changed files with 3 additions and 61 deletions

View File

@ -38,8 +38,8 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('colorator', "~> 0.1")
s.add_runtime_dependency('redcarpet', "~> 3.1")
s.add_runtime_dependency('toml', '~> 0.1.0')
s.add_runtime_dependency('sass', '~> 3.2')
s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0')
s.add_runtime_dependency('jekyll-sass-converter', '~> 1.0.0.rc1')
s.add_development_dependency('rake', "~> 10.1")
s.add_development_dependency('rdoc', "~> 3.11")

View File

@ -27,7 +27,6 @@ require 'liquid'
require 'maruku'
require 'colorator'
require 'toml'
require 'sass'
# internal requires
require 'jekyll/version'
@ -65,6 +64,7 @@ require_all 'jekyll/tags'
# plugins
require 'jekyll-coffeescript'
require 'jekyll-sass-converter'
SafeYAML::OPTIONS[:suppress_warnings] = true

View File

@ -1,58 +0,0 @@
module Jekyll
class Sass < Converter
safe true
priority :low
def matches(ext)
ext =~ /^\.s(a|c)ss$/i
end
def output_ext(ext)
".css"
end
def jekyll_sass_configuration
@config["sass"] || {}
end
def sass_build_configuration_options(overrides)
jekyll_sass_configuration.deep_merge(overrides).symbolize_keys
end
def syntax_type_of_content(content)
if content.include?(";") || content.include?("{")
:scss
else
:sass
end
end
def sass_dir
return "_sass" if jekyll_sass_configuration["sass_dir"].to_s.empty?
jekyll_sass_configuration["sass_dir"]
end
def sass_dir_relative_to_site_source
File.join(
@config["source"],
File.expand_path(sass_dir, "/") # FIXME: Not windows-compatible
)
end
def allow_caching?
!@config["safe"]
end
def sass_configs(content = "")
sass_build_configuration_options({
"syntax" => syntax_type_of_content(content),
"cache" => allow_caching?,
"load_paths" => [sass_dir_relative_to_site_source]
})
end
def convert(content)
::Sass.compile(content, sass_configs(content))
end
end
end

View File

@ -9,7 +9,7 @@ class TestSass < Test::Unit::TestCase
end
def converter(overrides = {})
Jekyll::Sass.new(site_configuration({"sass" => overrides}))
Jekyll::Converters::Sass.new(site_configuration({"sass" => overrides}))
end
def sass_content