jekyll-sass-converter-1.3.0/0000755000175000017500000000000012441174601015615 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/.rspec0000644000175000017500000000002512441174601016727 0ustar uwabamiuwabami--color --format doc jekyll-sass-converter-1.3.0/script/0000755000175000017500000000000012441174601017121 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/script/bootstrap0000755000175000017500000000003512441174601021062 0ustar uwabamiuwabami#! /bin/bash bundle install jekyll-sass-converter-1.3.0/script/release0000755000175000017500000000000012441174601020455 0ustar uwabamiuwabamijekyll-sass-converter-1.3.0/script/cibuild0000755000175000017500000000004012441174601020454 0ustar uwabamiuwabami#! /bin/bash bundle exec rspec jekyll-sass-converter-1.3.0/.gitignore0000644000175000017500000000026512441174601017610 0ustar uwabamiuwabami*.gem *.rbc .bundle .config .sass-cache .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp spec/dest/css* jekyll-sass-converter-1.3.0/History.markdown0000644000175000017500000000162112441174601021022 0ustar uwabamiuwabami## 1.3.0 / 2014-12-07 ### Minor Enhancements * Include line number in syntax error message (#26) * Raise a `Jekyll::Converters::Scss::SyntaxError` instead of just a `StandardError` (#29) ### Development Fixes * Fix typo in SCSS converter spec filename (#27) * Add tests for custom syntax error handling (#29) ## 1.2.1 / 2014-08-30 * Only include something in the sass load path if it exists (#23) ## 1.2.0 / 2014-07-31 ### Minor Enhancements * Allow user to specify style in safe mode. (#16) ### Development Fixes * Only include the `lib/` files in the gem. (#17) ## 1.1.0 / 2014-07-29 ### Minor Enhancements * Implement custom load paths (#14) * Lock down sass configuration when in safe mode. (#15) ## 1.0.0 / 2014-05-06 * Birthday! * Don't use core extensions (#2) * Allow users to set style of outputted CSS (#4) * Determine input syntax based on file extension (#9) jekyll-sass-converter-1.3.0/example/0000755000175000017500000000000012441174601017250 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/example/_sass/0000755000175000017500000000000012441174601020360 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/example/_sass/_typography.scss0000644000175000017500000000045312441174601023624 0ustar uwabamiuwabami// This is a partial. // It lies in /_sass, just waiting to be imported. // It does not contain the YAML front matter and has no corresponding output file in the built site. code, pre { font-family: Consolas, "Consolas for Powerline", "Courier New", Courier, monospace; color: green; } jekyll-sass-converter-1.3.0/example/css/0000755000175000017500000000000012441174601020040 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/example/css/main_css_file.scss0000644000175000017500000000031612441174601023530 0ustar uwabamiuwabami--- # this ensures Jekyll reads the file to be transformed into CSS later # only Main files contain this front matter, not partials. --- @import "typography"; .content { width: 80%; margin: 0 auto; } jekyll-sass-converter-1.3.0/example/_layouts/0000755000175000017500000000000012441174601021107 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/example/_layouts/default.html0000644000175000017500000000035412441174601023423 0ustar uwabamiuwabami Sass Example Site
{{ content }}
jekyll-sass-converter-1.3.0/example/README.md0000644000175000017500000000160712441174601020533 0ustar uwabamiuwabami--- layout: default --- # This is an example site for Sass integration in Jekyll You have two kinds of Sass files: 1. Main files, which you wish to be output as CSS files 2. Partials, which are used by main files in `@import` statements Main files are like pages – they go where you want them to be output, and they contain the YAML front matter (`---` lines) at the top. Partials are like hidden Jekyll data, so they go in an underscored directory, which defaults to `_sass`. You site might look like this: . | - _sass | - _typography.scss | - _layout.scss | - _colors.scss | - stylesheets | - screen.scss | - print.scss And so on. The output, in your `_site` directory, would look like this: . | - stylesheets | - screen.css | - print.css Boom! Now you have just your SCSS/Sass converted over to CSS with all the proper inputs. jekyll-sass-converter-1.3.0/example/index.md0000644000175000017500000000160712441174601020705 0ustar uwabamiuwabami--- layout: default --- # This is an example site for Sass integration in Jekyll You have two kinds of Sass files: 1. Main files, which you wish to be output as CSS files 2. Partials, which are used by main files in `@import` statements Main files are like pages – they go where you want them to be output, and they contain the YAML front matter (`---` lines) at the top. Partials are like hidden Jekyll data, so they go in an underscored directory, which defaults to `_sass`. You site might look like this: . | - _sass | - _typography.scss | - _layout.scss | - _colors.scss | - stylesheets | - screen.scss | - print.scss And so on. The output, in your `_site` directory, would look like this: . | - stylesheets | - screen.css | - print.css Boom! Now you have just your SCSS/Sass converted over to CSS with all the proper inputs. jekyll-sass-converter-1.3.0/LICENSE.txt0000644000175000017500000000205512441174601017442 0ustar uwabamiuwabamiCopyright (c) 2014 Parker Moore MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jekyll-sass-converter-1.3.0/jekyll-sass-converter.gemspec0000644000175000017500000000156512441174601023437 0ustar uwabamiuwabami# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jekyll-sass-converter/version' Gem::Specification.new do |spec| spec.name = "jekyll-sass-converter" spec.version = JekyllSassConverter::VERSION spec.authors = ["Parker Moore"] spec.email = ["parkrmoore@gmail.com"] spec.summary = %q{A basic Sass converter for Jekyll.} spec.homepage = "https://github.com/jekyll/jekyll-sass-converter" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").grep(%r{^lib/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "sass", "~> 3.2" spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" spec.add_development_dependency "jekyll", "~> 2.0" end jekyll-sass-converter-1.3.0/lib/0000755000175000017500000000000012441174601016363 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/lib/jekyll/0000755000175000017500000000000012441174601017655 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/lib/jekyll/converters/0000755000175000017500000000000012441174601022047 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/lib/jekyll/converters/scss.rb0000644000175000017500000000453012441174601023351 0ustar uwabamiuwabamirequire 'sass' require 'jekyll/utils' module Jekyll module Converters class Scss < Converter SyntaxError = Class.new(ArgumentError) safe true priority :low ALLOWED_STYLES = %w(nested expanded compact compressed).freeze def matches(ext) ext =~ /^\.scss$/i end def output_ext(ext) ".css" end def safe? !!@config["safe"] end def jekyll_sass_configuration options = @config["sass"] || {} unless options["style"].nil? options["style"] = options["style"].to_s.gsub(/\A:/, '').to_sym end options end def sass_build_configuration_options(overrides) if safe? { :load_paths => sass_load_paths, :syntax => syntax, :style => sass_style, :cache => false } else Jekyll::Utils.symbolize_hash_keys( Jekyll::Utils.deep_merge_hashes( jekyll_sass_configuration, overrides ) ) end end def syntax :scss end def sass_dir return "_sass" if jekyll_sass_configuration["sass_dir"].to_s.empty? jekyll_sass_configuration["sass_dir"] end def sass_style style = jekyll_sass_configuration.fetch("style", :compact) ALLOWED_STYLES.include?(style.to_s) ? style.to_sym : :compact end def user_sass_load_paths Array(jekyll_sass_configuration["load_paths"]) end def sass_dir_relative_to_site_source Jekyll.sanitized_path(@config["source"], sass_dir) end def sass_load_paths if safe? [sass_dir_relative_to_site_source] else (user_sass_load_paths + [sass_dir_relative_to_site_source]).uniq end.select { |load_path| File.directory?(load_path) } end def allow_caching? !safe? end def sass_configs sass_build_configuration_options({ "syntax" => syntax, "cache" => allow_caching?, "load_paths" => sass_load_paths }) end def convert(content) ::Sass.compile(content, sass_configs) rescue ::Sass::SyntaxError => e raise SyntaxError.new("#{e.to_s} on line #{e.sass_line}") end end end end jekyll-sass-converter-1.3.0/lib/jekyll/converters/sass.rb0000644000175000017500000000043512441174601023347 0ustar uwabamiuwabamirequire 'sass' require 'jekyll/utils' require 'jekyll/converters/scss' module Jekyll module Converters class Sass < Scss safe true priority :low def matches(ext) ext =~ /^\.sass$/i end def syntax :sass end end end end jekyll-sass-converter-1.3.0/lib/jekyll-sass-converter.rb0000644000175000017500000000021212441174601023151 0ustar uwabamiuwabamirequire "jekyll-sass-converter/version" require "jekyll/converters/scss" require "jekyll/converters/sass" module JekyllSassConverter end jekyll-sass-converter-1.3.0/lib/jekyll-sass-converter/0000755000175000017500000000000012441174601022631 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/lib/jekyll-sass-converter/version.rb0000644000175000017500000000006312441174601024642 0ustar uwabamiuwabamimodule JekyllSassConverter VERSION = "1.3.0" end jekyll-sass-converter-1.3.0/.travis.yml0000644000175000017500000000014212441174601017723 0ustar uwabamiuwabamilanguage: ruby script : script/cibuild rvm: - 2.1.0 - 2.0.0 - 1.9.3 notifications: email: false jekyll-sass-converter-1.3.0/Rakefile0000644000175000017500000000003412441174601017257 0ustar uwabamiuwabamirequire "bundler/gem_tasks" jekyll-sass-converter-1.3.0/spec/0000755000175000017500000000000012441174601016547 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/other_sass_library/0000755000175000017500000000000012441174601022445 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/other_sass_library/_sass/0000755000175000017500000000000012441174601023555 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/other_sass_library/_sass/_color.scss0000644000175000017500000000003012441174601025720 0ustar uwabamiuwabamia { color: #999999; } jekyll-sass-converter-1.3.0/spec/other_sass_library/css/0000755000175000017500000000000012441174601023235 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/other_sass_library/css/main.scss0000644000175000017500000000003212441174601025051 0ustar uwabamiuwabami--- --- @import "color"; jekyll-sass-converter-1.3.0/spec/spec_helper.rb0000644000175000017500000000202512441174601021364 0ustar uwabamiuwabami# coding: utf-8 require 'fileutils' require 'jekyll' lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jekyll-sass-converter' if Jekyll::VERSION > "1" Jekyll.logger.log_level = :error else Jekyll.logger.log_level = Jekyll::Stevenson::ERROR end RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus config.order = 'random' SOURCE_DIR = File.expand_path("../source", __FILE__) DEST_DIR = File.expand_path("../dest", __FILE__) SASS_LIB_DIR = File.expand_path("../other_sass_library", __FILE__) FileUtils.rm_rf(DEST_DIR) FileUtils.mkdir_p(DEST_DIR) def source_dir(*files) File.join(SOURCE_DIR, *files) end def dest_dir(*files) File.join(DEST_DIR, *files) end def sass_lib(*files) File.join(SASS_LIB_DIR, *files) end def site_configuration(overrides = {}) Jekyll.configuration(overrides.merge({ "source" => source_dir, "destination" => dest_dir })) end end jekyll-sass-converter-1.3.0/spec/sass_converter_spec.rb0000644000175000017500000000255312441174601023153 0ustar uwabamiuwabamirequire 'spec_helper' describe(Jekyll::Converters::Sass) do let(:site) do Jekyll::Site.new(site_configuration) end let(:content) do <<-SASS // tl;dr some sass $font-stack: Helvetica, sans-serif body font-family: $font-stack font-color: fuschia SASS end let(:css_output) do <<-CSS body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } CSS end let(:invalid_content) do <<-SASS font-family: $font-stack; SASS end def compressed(content) content.gsub(/\s+/, '').gsub(/;}/, '}') + "\n" end def converter(overrides = {}) Jekyll::Converters::Sass.new(site_configuration({"sass" => overrides})) end context "matching file extensions" do it "does not match .scss files" do expect(converter.matches(".scss")).to be_falsey end it "matches .sass files" do expect(converter.matches(".sass")).to be_truthy end end context "converting sass" do it "produces CSS" do expect(converter.convert(content)).to eql(compressed(css_output)) end it "includes the syntax error line in the syntax error message" do error_message = "Invalid CSS after \"$font-stack\": expected expression (e.g. 1px, bold), was \";\" on line 1" expect { converter.convert(invalid_content) }.to raise_error(Jekyll::Converters::Scss::SyntaxError, error_message) end end end jekyll-sass-converter-1.3.0/spec/scss_converter_spec.rb0000644000175000017500000001434612441174601023160 0ustar uwabamiuwabamirequire 'spec_helper' describe(Jekyll::Converters::Scss) do let(:site) do Jekyll::Site.new(site_configuration) end let(:content) do <<-SCSS $font-stack: Helvetica, sans-serif; body { font-family: $font-stack; font-color: fuschia; } SCSS end let(:css_output) do <<-CSS body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } CSS end let(:invalid_content) do <<-SCSS $font-stack: Helvetica body { font-family: $font-stack; SCSS end def compressed(content) content.gsub(/\s+/, '').gsub(/;}/, '}') + "\n" end def converter(overrides = {}) Jekyll::Converters::Scss.new(site_configuration({"sass" => overrides})) end context "matching file extensions" do it "matches .scss files" do expect(converter.matches(".scss")).to be_truthy end it "does not match .sass files" do expect(converter.matches(".sass")).to be_falsey end end context "determining the output file extension" do it "always outputs the .css file extension" do expect(converter.output_ext(".always-css")).to eql(".css") end end context "when building configurations" do it "allow caching in unsafe mode" do expect(converter.sass_configs[:cache]).to be_truthy end it "set the load paths to the _sass dir relative to site source" do expect(converter.sass_configs[:load_paths]).to eql([source_dir("_sass")]) end it "allow for other styles" do expect(converter({"style" => :compressed}).sass_configs[:style]).to eql(:compressed) end context "when specifying sass dirs" do context "when the sass dir exists" do it "allow the user to specify a different sass dir" do FileUtils.mkdir(source_dir('_scss')) expect(converter({"sass_dir" => "_scss"}).sass_configs[:load_paths]).to eql([source_dir("_scss")]) FileUtils.rmdir(source_dir('_scss')) end it "not allow sass_dirs outside of site source" do expect( converter({"sass_dir" => "/etc/passwd"}).sass_dir_relative_to_site_source ).to eql(source_dir("etc/passwd")) end end end context "in safe mode" do let(:verter) { Jekyll::Converters::Scss.new(site.config.merge({ "sass" => {}, "safe" => true })) } it "does not allow caching" do expect(verter.sass_configs[:cache]).to be_falsey end it "forces load_paths to be just the local load path" do expect(verter.sass_configs[:load_paths]).to eql([source_dir("_sass")]) end it "allows the user to specify the style" do allow(verter).to receive(:sass_style).and_return(:compressed) expect(verter.sass_configs[:style]).to eql(:compressed) end it "defaults style to :compact" do expect(verter.sass_configs[:style]).to eql(:compact) end it "only contains :syntax, :cache, :style, and :load_paths keys" do expect(verter.sass_configs.keys).to eql([:load_paths, :syntax, :style, :cache]) end end end context "converting SCSS" do it "produces CSS" do expect(converter.convert(content)).to eql(compressed(css_output)) end it "includes the syntax error line in the syntax error message" do error_message = 'Invalid CSS after "body ": expected selector or at-rule, was "{" on line 2' expect { converter.convert(invalid_content) }.to raise_error(Jekyll::Converters::Scss::SyntaxError, error_message) end end context "importing partials" do let(:test_css_file) { dest_dir("css/main.css") } before(:each) { site.process } it "outputs the CSS file" do expect(File.exist?(test_css_file)).to be_truthy end it "imports SCSS partial" do expect(File.read(test_css_file)).to eql(compressed(".half {\n width: 50%; }\n")) end it "uses a compressed style" do instance = site.getConverterImpl(Jekyll::Converters::Scss) expect(instance.jekyll_sass_configuration).to eql({"style" => :compressed}) expect(instance.sass_configs[:style]).to eql(:compressed) end end context "importing from external libraries" do let(:external_library) { source_dir("bower_components/jquery") } let(:verter) { site.getConverterImpl(Jekyll::Converters::Scss) } let(:test_css_file) { dest_dir('css', 'main.css') } context "unsafe mode" do let(:site) do Jekyll::Site.new(site_configuration.merge({ "source" => sass_lib, "sass" => { "load_paths" => external_library } })) end before(:each) do FileUtils.mkdir_p(external_library) unless File.directory?(external_library) end after(:each) do FileUtils.mkdir_p(external_library) unless File.directory?(external_library) end it "recognizes the new load path" do expect(verter.sass_load_paths).to include(external_library) end it "ensures the sass_dir is still in the load path" do expect(verter.sass_load_paths).to include(sass_lib("_sass")) end it "brings in the grid partial" do site.process expect(File.read(test_css_file)).to eql("a {\n color: #999999; }\n") end context "with the sass_dir specified twice" do let(:site) do Jekyll::Site.new(site_configuration.merge({ "source" => sass_lib, "sass" => { "load_paths" => [ external_library, sass_lib("_sass") ] } })) end it "ensures the sass_dir only occurrs once in the load path" do expect(verter.sass_load_paths).to eql([external_library, sass_lib("_sass")]) end end end context "safe mode" do let(:site) do Jekyll::Site.new(site_configuration.merge({ "safe" => true, "source" => sass_lib, "sass" => { "load_paths" => external_library } })) end it "ignores the new load path" do expect(verter.sass_load_paths).not_to include(external_library) end it "ensures the sass_dir is the entire load path" do expect(verter.sass_load_paths).to eql([sass_lib("_sass")]) end end end end jekyll-sass-converter-1.3.0/spec/source/0000755000175000017500000000000012441174601020047 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/source/_sass/0000755000175000017500000000000012441174601021157 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/source/_sass/_grid.scss0000644000175000017500000000002512441174601023135 0ustar uwabamiuwabami.half { width: 50%; }jekyll-sass-converter-1.3.0/spec/source/_sass/_color.scss0000644000175000017500000000004212441174601023325 0ustar uwabamiuwabami$black: #999; a { color: $black; }jekyll-sass-converter-1.3.0/spec/source/css/0000755000175000017500000000000012441174601020637 5ustar uwabamiuwabamijekyll-sass-converter-1.3.0/spec/source/css/main.scss0000644000175000017500000000003012441174601022451 0ustar uwabamiuwabami--- --- @import "grid";jekyll-sass-converter-1.3.0/spec/source/_config.yml0000644000175000017500000000005612441174601022177 0ustar uwabamiuwabamisass: style: :compressed highlighter: rouge jekyll-sass-converter-1.3.0/Gemfile0000644000175000017500000000004612441174601017110 0ustar uwabamiuwabamisource 'https://rubygems.org' gemspec jekyll-sass-converter-1.3.0/README.md0000644000175000017500000000201712441174601017074 0ustar uwabamiuwabami# Jekyll Sass Converter Let Jekyll build your Sass and SCSS! [![Build Status](https://travis-ci.org/jekyll/jekyll-sass-converter.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-sass-converter) ## Installation **Jekyll Sass Converter requires Jekyll 2.0.0 or greater and is bundled with Jekyll so you don't need to install it if you're already using Jekyll.** Add this line to your application's Gemfile: gem 'jekyll-sass-converter' And then execute: $ bundle Or install it yourself as: $ gem install jekyll-sass-converter ## Usage Jekyll Sass Converter comes bundled with Jekyll 2.0.0 and greater. For more information about usage, visit the [Jekyll Assets Documentation page](http://jekyllrb.com/docs/assets/). ## Contributing 1. Fork it ( http://github.com/jekyll/jekyll-sass-converter/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request