jekyll-sass-converter 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -1
- data/Gemfile +0 -5
- data/History.markdown +10 -5
- data/jekyll-sass-converter.gemspec +1 -0
- data/lib/jekyll-sass-converter/version.rb +1 -1
- data/lib/jekyll/converters/scss.rb +34 -8
- data/spec/other_sass_library/css/main.scss +4 -0
- data/spec/sass_coverter_spec.rb +2 -2
- data/spec/scss_converter_spec.rb +93 -9
- data/spec/source/_sass/_color.scss +2 -0
- data/spec/spec_helper.rb +12 -4
- metadata +20 -4
- data/spec/dest/css/main.css +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2378debab502ac8be28921965bf56e8090f3c871
|
4
|
+
data.tar.gz: 5a71a60854bef153d688423634a9f7d70fff67d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21b5e7c01f43a6423f0e7013fde7952aa8b3f8f80d897da80e3f111da68be399eabe906cab23a1e7d623686bf3e909981249395b15b8cca811d3bacca3600193
|
7
|
+
data.tar.gz: 5c8f0cfd2b0c1ca3116f3de158b4f34f0a265f9f6156a19881e4d26662a3ac0eb35d9abab9830e0e8fa7c11be9582e3f4657b04cda8a587fec9d0834de520347
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
2
|
+
--format doc
|
data/Gemfile
CHANGED
data/History.markdown
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
##
|
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)
|
2
7
|
|
3
8
|
## 1.0.0 / 2014-05-06
|
4
9
|
|
5
|
-
* Birthday!
|
6
|
-
* Don't use core extensions (#2)
|
7
|
-
* Allow users to set style of outputted CSS (#4)
|
8
|
-
* Determine input syntax based on file extension (#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)
|
@@ -15,6 +15,10 @@ module Jekyll
|
|
15
15
|
".css"
|
16
16
|
end
|
17
17
|
|
18
|
+
def safe?
|
19
|
+
!!@config["safe"]
|
20
|
+
end
|
21
|
+
|
18
22
|
def jekyll_sass_configuration
|
19
23
|
options = @config["sass"] || {}
|
20
24
|
unless options["style"].nil?
|
@@ -24,9 +28,20 @@ module Jekyll
|
|
24
28
|
end
|
25
29
|
|
26
30
|
def sass_build_configuration_options(overrides)
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
if safe?
|
32
|
+
{
|
33
|
+
:load_paths => sass_load_paths,
|
34
|
+
:syntax => syntax,
|
35
|
+
:cache => false
|
36
|
+
}
|
37
|
+
else
|
38
|
+
Jekyll::Utils.symbolize_hash_keys(
|
39
|
+
Jekyll::Utils.deep_merge_hashes(
|
40
|
+
jekyll_sass_configuration,
|
41
|
+
overrides
|
42
|
+
)
|
43
|
+
)
|
44
|
+
end
|
30
45
|
end
|
31
46
|
|
32
47
|
def syntax
|
@@ -38,25 +53,36 @@ module Jekyll
|
|
38
53
|
jekyll_sass_configuration["sass_dir"]
|
39
54
|
end
|
40
55
|
|
56
|
+
def user_sass_load_paths
|
57
|
+
Array(jekyll_sass_configuration["load_paths"])
|
58
|
+
end
|
59
|
+
|
41
60
|
def sass_dir_relative_to_site_source
|
42
|
-
# FIXME: Not Windows-safe. Can only change once Jekyll 2.0.0 is out
|
43
61
|
Jekyll.sanitized_path(@config["source"], sass_dir)
|
44
62
|
end
|
45
63
|
|
64
|
+
def sass_load_paths
|
65
|
+
if safe?
|
66
|
+
[sass_dir_relative_to_site_source]
|
67
|
+
else
|
68
|
+
(user_sass_load_paths + [sass_dir_relative_to_site_source]).uniq
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
46
72
|
def allow_caching?
|
47
|
-
|
73
|
+
!safe?
|
48
74
|
end
|
49
75
|
|
50
|
-
def sass_configs
|
76
|
+
def sass_configs
|
51
77
|
sass_build_configuration_options({
|
52
78
|
"syntax" => syntax,
|
53
79
|
"cache" => allow_caching?,
|
54
|
-
"load_paths" =>
|
80
|
+
"load_paths" => sass_load_paths
|
55
81
|
})
|
56
82
|
end
|
57
83
|
|
58
84
|
def convert(content)
|
59
|
-
::Sass.compile(content, sass_configs
|
85
|
+
::Sass.compile(content, sass_configs)
|
60
86
|
end
|
61
87
|
end
|
62
88
|
end
|
data/spec/sass_coverter_spec.rb
CHANGED
@@ -29,11 +29,11 @@ CSS
|
|
29
29
|
|
30
30
|
context "matching file extensions" do
|
31
31
|
it "does not match .scss files" do
|
32
|
-
expect(converter.matches(".scss")).to
|
32
|
+
expect(converter.matches(".scss")).to be_falsey
|
33
33
|
end
|
34
34
|
|
35
35
|
it "matches .sass files" do
|
36
|
-
expect(converter.matches(".sass")).to
|
36
|
+
expect(converter.matches(".sass")).to be_truthy
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
data/spec/scss_converter_spec.rb
CHANGED
@@ -29,11 +29,11 @@ CSS
|
|
29
29
|
|
30
30
|
context "matching file extensions" do
|
31
31
|
it "matches .scss files" do
|
32
|
-
expect(converter.matches(".scss")).to
|
32
|
+
expect(converter.matches(".scss")).to be_truthy
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does not match .sass files" do
|
36
|
-
expect(converter.matches(".sass")).to
|
36
|
+
expect(converter.matches(".sass")).to be_falsey
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -44,14 +44,9 @@ CSS
|
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when building configurations" do
|
47
|
-
it "not allow caching in safe mode" do
|
48
|
-
verter = converter
|
49
|
-
verter.instance_variable_get(:@config)["safe"] = true
|
50
|
-
expect(verter.sass_configs[:cache]).to be_false
|
51
|
-
end
|
52
47
|
|
53
48
|
it "allow caching in unsafe mode" do
|
54
|
-
expect(converter.sass_configs[:cache]).to
|
49
|
+
expect(converter.sass_configs[:cache]).to be_truthy
|
55
50
|
end
|
56
51
|
|
57
52
|
it "set the load paths to the _sass dir relative to site source" do
|
@@ -71,6 +66,26 @@ CSS
|
|
71
66
|
converter({"sass_dir" => "/etc/passwd"}).sass_dir_relative_to_site_source
|
72
67
|
).to eql(source_dir("etc/passwd"))
|
73
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
|
74
89
|
end
|
75
90
|
|
76
91
|
context "converting SCSS" do
|
@@ -84,7 +99,7 @@ CSS
|
|
84
99
|
before(:each) { site.process }
|
85
100
|
|
86
101
|
it "outputs the CSS file" do
|
87
|
-
expect(File.exist?(test_css_file)).to
|
102
|
+
expect(File.exist?(test_css_file)).to be_truthy
|
88
103
|
end
|
89
104
|
|
90
105
|
it "imports SCSS partial" do
|
@@ -98,4 +113,73 @@ CSS
|
|
98
113
|
end
|
99
114
|
end
|
100
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
|
+
|
101
185
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,16 +6,20 @@ lib = File.expand_path('../lib', __FILE__)
|
|
6
6
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
7
|
require 'jekyll-sass-converter'
|
8
8
|
|
9
|
-
Jekyll
|
9
|
+
if Jekyll::VERSION > "1"
|
10
|
+
Jekyll.logger.log_level = :error
|
11
|
+
else
|
12
|
+
Jekyll.logger.log_level = Jekyll::Stevenson::ERROR
|
13
|
+
end
|
10
14
|
|
11
15
|
RSpec.configure do |config|
|
12
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
16
|
config.run_all_when_everything_filtered = true
|
14
17
|
config.filter_run :focus
|
15
18
|
config.order = 'random'
|
16
19
|
|
17
|
-
SOURCE_DIR
|
18
|
-
DEST_DIR
|
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__)
|
19
23
|
FileUtils.rm_rf(DEST_DIR)
|
20
24
|
FileUtils.mkdir_p(DEST_DIR)
|
21
25
|
|
@@ -27,6 +31,10 @@ RSpec.configure do |config|
|
|
27
31
|
File.join(DEST_DIR, *files)
|
28
32
|
end
|
29
33
|
|
34
|
+
def sass_lib(*files)
|
35
|
+
File.join(SASS_LIB_DIR, *files)
|
36
|
+
end
|
37
|
+
|
30
38
|
def site_configuration(overrides = {})
|
31
39
|
Jekyll.configuration(overrides.merge({
|
32
40
|
"source" => source_dir,
|
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.
|
4
|
+
version: 1.1.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-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jekyll
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- parkrmoore@gmail.com
|
@@ -89,10 +103,11 @@ files:
|
|
89
103
|
- script/bootstrap
|
90
104
|
- script/cibuild
|
91
105
|
- script/release
|
92
|
-
- spec/
|
106
|
+
- spec/other_sass_library/css/main.scss
|
93
107
|
- spec/sass_coverter_spec.rb
|
94
108
|
- spec/scss_converter_spec.rb
|
95
109
|
- spec/source/_config.yml
|
110
|
+
- spec/source/_sass/_color.scss
|
96
111
|
- spec/source/_sass/_grid.scss
|
97
112
|
- spec/source/css/main.scss
|
98
113
|
- spec/spec_helper.rb
|
@@ -121,10 +136,11 @@ signing_key:
|
|
121
136
|
specification_version: 4
|
122
137
|
summary: A basic Sass converter for Jekyll.
|
123
138
|
test_files:
|
124
|
-
- spec/
|
139
|
+
- spec/other_sass_library/css/main.scss
|
125
140
|
- spec/sass_coverter_spec.rb
|
126
141
|
- spec/scss_converter_spec.rb
|
127
142
|
- spec/source/_config.yml
|
143
|
+
- spec/source/_sass/_color.scss
|
128
144
|
- spec/source/_sass/_grid.scss
|
129
145
|
- spec/source/css/main.scss
|
130
146
|
- spec/spec_helper.rb
|
data/spec/dest/css/main.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
.half{width:50%}
|