jekyll-sass-converter 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2378debab502ac8be28921965bf56e8090f3c871
4
- data.tar.gz: 5a71a60854bef153d688423634a9f7d70fff67d1
3
+ metadata.gz: f666e5d408f21c6a615d9d0e4012b8fc5b390db5
4
+ data.tar.gz: 39961610cc568a0ea9164fd3261a6580441390b8
5
5
  SHA512:
6
- metadata.gz: 21b5e7c01f43a6423f0e7013fde7952aa8b3f8f80d897da80e3f111da68be399eabe906cab23a1e7d623686bf3e909981249395b15b8cca811d3bacca3600193
7
- data.tar.gz: 5c8f0cfd2b0c1ca3116f3de158b4f34f0a265f9f6156a19881e4d26662a3ac0eb35d9abab9830e0e8fa7c11be9582e3f4657b04cda8a587fec9d0834de520347
6
+ metadata.gz: d0256dc05f45df12d1003985f1543f12f89a294d8d54257378931891f378aa024c80c0e5353e99051d93a878e6b6e88e774f6800739fe4f29e3a106320b9a855
7
+ data.tar.gz: 7a35e110fb21584266a7b76af7d65aad5793baa5303497f839fa2997d5c95d8977283a7d4be222221d10e14316d20c5205b3bfd348ca4139735a0ee2d8b09cb4
@@ -1,3 +1,3 @@
1
1
  module JekyllSassConverter
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -7,6 +7,8 @@ module Jekyll
7
7
  safe true
8
8
  priority :low
9
9
 
10
+ ALLOWED_STYLES = %w(nested expanded compact compressed).freeze
11
+
10
12
  def matches(ext)
11
13
  ext =~ /^\.scss$/i
12
14
  end
@@ -32,6 +34,7 @@ module Jekyll
32
34
  {
33
35
  :load_paths => sass_load_paths,
34
36
  :syntax => syntax,
37
+ :style => sass_style,
35
38
  :cache => false
36
39
  }
37
40
  else
@@ -53,6 +56,11 @@ module Jekyll
53
56
  jekyll_sass_configuration["sass_dir"]
54
57
  end
55
58
 
59
+ def sass_style
60
+ style = jekyll_sass_configuration.fetch("style", :compact)
61
+ ALLOWED_STYLES.include?(style.to_s) ? style.to_sym : :compact
62
+ end
63
+
56
64
  def user_sass_load_paths
57
65
  Array(jekyll_sass_configuration["load_paths"])
58
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-sass-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-29 00:00:00.000000000 Z
11
+ date: 2014-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -87,30 +87,10 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
91
- - ".rspec"
92
- - ".travis.yml"
93
- - Gemfile
94
- - History.markdown
95
- - LICENSE.txt
96
- - README.md
97
- - Rakefile
98
- - jekyll-sass-converter.gemspec
99
90
  - lib/jekyll-sass-converter.rb
100
91
  - lib/jekyll-sass-converter/version.rb
101
92
  - lib/jekyll/converters/sass.rb
102
93
  - lib/jekyll/converters/scss.rb
103
- - script/bootstrap
104
- - script/cibuild
105
- - script/release
106
- - spec/other_sass_library/css/main.scss
107
- - spec/sass_coverter_spec.rb
108
- - spec/scss_converter_spec.rb
109
- - spec/source/_config.yml
110
- - spec/source/_sass/_color.scss
111
- - spec/source/_sass/_grid.scss
112
- - spec/source/css/main.scss
113
- - spec/spec_helper.rb
114
94
  homepage: https://github.com/jekyll/jekyll-sass-converter
115
95
  licenses:
116
96
  - MIT
@@ -135,12 +115,4 @@ rubygems_version: 2.2.2
135
115
  signing_key:
136
116
  specification_version: 4
137
117
  summary: A basic Sass converter for Jekyll.
138
- test_files:
139
- - spec/other_sass_library/css/main.scss
140
- - spec/sass_coverter_spec.rb
141
- - spec/scss_converter_spec.rb
142
- - spec/source/_config.yml
143
- - spec/source/_sass/_color.scss
144
- - spec/source/_sass/_grid.scss
145
- - spec/source/css/main.scss
146
- - spec/spec_helper.rb
118
+ test_files: []
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .sass-cache
6
- .yardoc
7
- Gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
- pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
19
- spec/dest/css*
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format doc
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- script : script/cibuild
3
- rvm:
4
- - 2.1.0
5
- - 2.0.0
6
- - 1.9.3
7
- notifications:
8
- email: false
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/History.markdown DELETED
@@ -1,13 +0,0 @@
1
- ## 1.1.0 / 2014-07-29
2
-
3
- ### Minor Enhancements
4
-
5
- * Implement custom load paths (#14)
6
- * Lock down sass configuration when in safe mode. (#15)
7
-
8
- ## 1.0.0 / 2014-05-06
9
-
10
- * Birthday!
11
- * Don't use core extensions (#2)
12
- * Allow users to set style of outputted CSS (#4)
13
- * Determine input syntax based on file extension (#9)
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Parker Moore
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Jekyll Sass Converter
2
-
3
- Let Jekyll build your Sass and SCSS!
4
-
5
- [![Build Status](https://travis-ci.org/jekyll/jekyll-sass-converter.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-sass-converter)
6
-
7
- ## Installation
8
-
9
- **Jekyll Sass Converter requires Jekyll 2.0.0 or greater and is bundled
10
- with Jekyll so you don't need to install it if you're already using Jekyll.**
11
-
12
- Add this line to your application's Gemfile:
13
-
14
- gem 'jekyll-sass-converter'
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
- $ gem install jekyll-sass-converter
23
-
24
- ## Usage
25
-
26
- Jekyll Sass Converter comes bundled with Jekyll 2.0.0 and greater. For more
27
- information about usage, visit the [Jekyll Assets Documentation
28
- page](http://jekyllrb.com/docs/assets/).
29
-
30
- ## Contributing
31
-
32
- 1. Fork it ( http://github.com/jekyll/jekyll-sass-converter/fork )
33
- 2. Create your feature branch (`git checkout -b my-new-feature`)
34
- 3. Commit your changes (`git commit -am 'Add some feature'`)
35
- 4. Push to the branch (`git push origin my-new-feature`)
36
- 5. Create new Pull Request
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'jekyll-sass-converter/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "jekyll-sass-converter"
8
- spec.version = JekyllSassConverter::VERSION
9
- spec.authors = ["Parker Moore"]
10
- spec.email = ["parkrmoore@gmail.com"]
11
- spec.summary = %q{A basic Sass converter for Jekyll.}
12
- spec.homepage = "https://github.com/jekyll/jekyll-sass-converter"
13
- spec.license = "MIT"
14
-
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_runtime_dependency "sass", "~> 3.2"
21
-
22
- spec.add_development_dependency "bundler", "~> 1.5"
23
- spec.add_development_dependency "rake"
24
- spec.add_development_dependency "rspec"
25
- spec.add_development_dependency "jekyll", "~> 2.0"
26
- end
data/script/bootstrap DELETED
@@ -1,3 +0,0 @@
1
- #! /bin/bash
2
-
3
- bundle install
data/script/cibuild DELETED
@@ -1,3 +0,0 @@
1
- #! /bin/bash
2
-
3
- bundle exec rspec
data/script/release DELETED
File without changes
@@ -1,4 +0,0 @@
1
- ---
2
- ---
3
-
4
- @import "color";
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe(Jekyll::Converters::Sass) do
4
- let(:site) do
5
- Jekyll::Site.new(site_configuration)
6
- end
7
- let(:content) do
8
- <<-SASS
9
- // tl;dr some sass
10
- $font-stack: Helvetica, sans-serif
11
- body
12
- font-family: $font-stack
13
- font-color: fuschia
14
- SASS
15
- end
16
- let(:css_output) do
17
- <<-CSS
18
- body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; }
19
- CSS
20
- end
21
-
22
- def compressed(content)
23
- content.gsub(/\s+/, '').gsub(/;}/, '}') + "\n"
24
- end
25
-
26
- def converter(overrides = {})
27
- Jekyll::Converters::Sass.new(site_configuration({"sass" => overrides}))
28
- end
29
-
30
- context "matching file extensions" do
31
- it "does not match .scss files" do
32
- expect(converter.matches(".scss")).to be_falsey
33
- end
34
-
35
- it "matches .sass files" do
36
- expect(converter.matches(".sass")).to be_truthy
37
- end
38
- end
39
-
40
- context "converting sass" do
41
- it "produces CSS" do
42
- expect(converter.convert(content)).to eql(compressed(css_output))
43
- end
44
- end
45
-
46
- end
@@ -1,185 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe(Jekyll::Converters::Scss) do
4
- let(:site) do
5
- Jekyll::Site.new(site_configuration)
6
- end
7
- let(:content) do
8
- <<-SCSS
9
- $font-stack: Helvetica, sans-serif;
10
- body {
11
- font-family: $font-stack;
12
- font-color: fuschia;
13
- }
14
- SCSS
15
- end
16
- let(:css_output) do
17
- <<-CSS
18
- body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; }
19
- CSS
20
- end
21
-
22
- def compressed(content)
23
- content.gsub(/\s+/, '').gsub(/;}/, '}') + "\n"
24
- end
25
-
26
- def converter(overrides = {})
27
- Jekyll::Converters::Scss.new(site_configuration({"sass" => overrides}))
28
- end
29
-
30
- context "matching file extensions" do
31
- it "matches .scss files" do
32
- expect(converter.matches(".scss")).to be_truthy
33
- end
34
-
35
- it "does not match .sass files" do
36
- expect(converter.matches(".sass")).to be_falsey
37
- end
38
- end
39
-
40
- context "determining the output file extension" do
41
- it "always outputs the .css file extension" do
42
- expect(converter.output_ext(".always-css")).to eql(".css")
43
- end
44
- end
45
-
46
- context "when building configurations" do
47
-
48
- it "allow caching in unsafe mode" do
49
- expect(converter.sass_configs[:cache]).to be_truthy
50
- end
51
-
52
- it "set the load paths to the _sass dir relative to site source" do
53
- expect(converter.sass_configs[:load_paths]).to eql([source_dir("_sass")])
54
- end
55
-
56
- it "allow the user to specify a different sass dir" do
57
- expect(converter({"sass_dir" => "_scss"}).sass_configs[:load_paths]).to eql([source_dir("_scss")])
58
- end
59
-
60
- it "allow for other styles" do
61
- expect(converter({"style" => :compressed}).sass_configs[:style]).to eql(:compressed)
62
- end
63
-
64
- it "not allow sass_dirs outside of site source" do
65
- expect(
66
- converter({"sass_dir" => "/etc/passwd"}).sass_dir_relative_to_site_source
67
- ).to eql(source_dir("etc/passwd"))
68
- end
69
-
70
- context "in safe mode" do
71
- let(:verter) {
72
- c = converter
73
- c.instance_variable_get(:@config)["safe"] = true
74
- c
75
- }
76
-
77
- it "does not allow caching" do
78
- expect(verter.sass_configs[:cache]).to be_falsey
79
- end
80
-
81
- it "forces load_paths to be just the local load path" do
82
- expect(verter.sass_configs[:load_paths]).to eql([source_dir("_sass")])
83
- end
84
-
85
- it "only contains :syntax, :cache, and :load_paths keys" do
86
- expect(verter.sass_configs.keys).to eql([:load_paths, :syntax, :cache])
87
- end
88
- end
89
- end
90
-
91
- context "converting SCSS" do
92
- it "produces CSS" do
93
- expect(converter.convert(content)).to eql(compressed(css_output))
94
- end
95
- end
96
-
97
- context "importing partials" do
98
- let(:test_css_file) { dest_dir("css/main.css") }
99
- before(:each) { site.process }
100
-
101
- it "outputs the CSS file" do
102
- expect(File.exist?(test_css_file)).to be_truthy
103
- end
104
-
105
- it "imports SCSS partial" do
106
- expect(File.read(test_css_file)).to eql(compressed(".half {\n width: 50%; }\n"))
107
- end
108
-
109
- it "uses a compressed style" do
110
- instance = site.getConverterImpl(Jekyll::Converters::Scss)
111
- expect(instance.jekyll_sass_configuration).to eql({"style" => :compressed})
112
- expect(instance.sass_configs[:style]).to eql(:compressed)
113
- end
114
- end
115
-
116
- context "importing from external libraries" do
117
- let(:external_library) { source_dir("_sass") }
118
- let(:verter) { site.getConverterImpl(Jekyll::Converters::Scss) }
119
- let(:test_css_file) { dest_dir('css', 'main.css') }
120
-
121
- context "unsafe mode" do
122
- let(:site) do
123
- Jekyll::Site.new(site_configuration.merge({
124
- "source" => sass_lib,
125
- "sass" => {
126
- "load_paths" => external_library
127
- }
128
- }))
129
- end
130
-
131
- it "recognizes the new load path" do
132
- expect(verter.sass_load_paths).to include(external_library)
133
- end
134
-
135
- it "ensures the sass_dir is still in the load path" do
136
- expect(verter.sass_load_paths).to include(sass_lib("_sass"))
137
- end
138
-
139
- it "brings in the grid partial" do
140
- site.process
141
- expect(File.read(test_css_file)).to eql("a {\n color: #999999; }\n")
142
- end
143
-
144
- context "with the sass_dir specified twice" do
145
- let(:site) do
146
- Jekyll::Site.new(site_configuration.merge({
147
- "source" => sass_lib,
148
- "sass" => {
149
- "load_paths" => [
150
- external_library,
151
- sass_lib("_sass")
152
- ]
153
- }
154
- }))
155
- end
156
-
157
- it "ensures the sass_dir only occurrs once in the load path" do
158
- expect(verter.sass_load_paths).to eql([external_library, sass_lib("_sass")])
159
- end
160
- end
161
- end
162
-
163
- context "safe mode" do
164
- let(:site) do
165
- Jekyll::Site.new(site_configuration.merge({
166
- "safe" => true,
167
- "source" => sass_lib,
168
- "sass" => {
169
- "load_paths" => external_library
170
- }
171
- }))
172
- end
173
-
174
- it "ignores the new load path" do
175
- expect(verter.sass_load_paths).not_to include(external_library)
176
- end
177
-
178
- it "ensures the sass_dir is the entire load path" do
179
- expect(verter.sass_load_paths).to eql([sass_lib("_sass")])
180
- end
181
- end
182
-
183
- end
184
-
185
- end
@@ -1,3 +0,0 @@
1
- sass:
2
- style: :compressed
3
- highlighter: rouge
@@ -1,2 +0,0 @@
1
- $black: #999;
2
- a { color: $black; }
@@ -1 +0,0 @@
1
- .half { width: 50%; }
@@ -1,4 +0,0 @@
1
- ---
2
- ---
3
-
4
- @import "grid";
data/spec/spec_helper.rb DELETED
@@ -1,44 +0,0 @@
1
- # coding: utf-8
2
- require 'fileutils'
3
- require 'jekyll'
4
-
5
- lib = File.expand_path('../lib', __FILE__)
6
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
- require 'jekyll-sass-converter'
8
-
9
- if Jekyll::VERSION > "1"
10
- Jekyll.logger.log_level = :error
11
- else
12
- Jekyll.logger.log_level = Jekyll::Stevenson::ERROR
13
- end
14
-
15
- RSpec.configure do |config|
16
- config.run_all_when_everything_filtered = true
17
- config.filter_run :focus
18
- config.order = 'random'
19
-
20
- SOURCE_DIR = File.expand_path("../source", __FILE__)
21
- DEST_DIR = File.expand_path("../dest", __FILE__)
22
- SASS_LIB_DIR = File.expand_path("../other_sass_library", __FILE__)
23
- FileUtils.rm_rf(DEST_DIR)
24
- FileUtils.mkdir_p(DEST_DIR)
25
-
26
- def source_dir(*files)
27
- File.join(SOURCE_DIR, *files)
28
- end
29
-
30
- def dest_dir(*files)
31
- File.join(DEST_DIR, *files)
32
- end
33
-
34
- def sass_lib(*files)
35
- File.join(SASS_LIB_DIR, *files)
36
- end
37
-
38
- def site_configuration(overrides = {})
39
- Jekyll.configuration(overrides.merge({
40
- "source" => source_dir,
41
- "destination" => dest_dir
42
- }))
43
- end
44
- end