dassets-sass 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -1
- data/lib/dassets-sass/version.rb +1 -1
- data/lib/dassets-sass.rb +5 -0
- data/test/unit/engine_tests.rb +18 -5
- metadata +4 -4
data/README.md
CHANGED
@@ -20,10 +20,17 @@ Dassets.configure do |c|
|
|
20
20
|
# register for `sass` syntax
|
21
21
|
s.engine 'sass', Dassets::Sass::Engine, :syntax => 'sass'
|
22
22
|
|
23
|
+
# by default `:nested` output style is used, but you can
|
24
|
+
# specify a custom style (http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style)
|
25
|
+
s.engine 'scss', Dassets::Sass::Engine, {
|
26
|
+
...
|
27
|
+
:output_style => :compressed
|
28
|
+
}
|
29
|
+
|
23
30
|
# by default `/path/to/assets` is in the load paths, but
|
24
31
|
# you can specify additional custom load paths to use with `@import`s
|
25
32
|
s.engine 'scss', Dassets::Sass::Engine, {
|
26
|
-
|
33
|
+
...
|
27
34
|
:load_paths => ['/custom/load/path']
|
28
35
|
}
|
29
36
|
end
|
data/lib/dassets-sass/version.rb
CHANGED
data/lib/dassets-sass.rb
CHANGED
@@ -10,6 +10,10 @@ module Dassets::Sass
|
|
10
10
|
(self.opts[:syntax] || self.opts['syntax'] || 'scss').to_s
|
11
11
|
end
|
12
12
|
|
13
|
+
def output_style
|
14
|
+
(self.opts[:output_style] || self.opts['output_style'] || 'nested').to_s
|
15
|
+
end
|
16
|
+
|
13
17
|
def load_paths
|
14
18
|
@load_paths ||= ([self.opts['source_path']] +
|
15
19
|
[*(self.opts[:load_paths] || self.opts['load_paths'] || [])])
|
@@ -22,6 +26,7 @@ module Dassets::Sass
|
|
22
26
|
def compile(input_content)
|
23
27
|
::Sass.compile(input_content, {
|
24
28
|
:syntax => self.syntax.to_sym,
|
29
|
+
:style => self.output_style.to_sym,
|
25
30
|
:load_paths => self.load_paths
|
26
31
|
})
|
27
32
|
end
|
data/test/unit/engine_tests.rb
CHANGED
@@ -14,7 +14,7 @@ class Dassets::Sass::Engine
|
|
14
14
|
end
|
15
15
|
subject{ @engine }
|
16
16
|
|
17
|
-
should have_imeths :syntax, :load_paths
|
17
|
+
should have_imeths :syntax, :output_style, :load_paths
|
18
18
|
|
19
19
|
should "be a Dassets engine" do
|
20
20
|
assert_kind_of Dassets::Engine, subject
|
@@ -23,11 +23,21 @@ class Dassets::Sass::Engine
|
|
23
23
|
end
|
24
24
|
|
25
25
|
should "default the syntax to `scss`" do
|
26
|
-
assert_equal 'scss',
|
26
|
+
assert_equal 'scss', subject.syntax
|
27
27
|
end
|
28
28
|
|
29
|
-
should "allow specifying
|
30
|
-
|
29
|
+
should "allow specifying a custom syntax value" do
|
30
|
+
engine = Dassets::Sass::Engine.new(:syntax => 'sass')
|
31
|
+
assert_equal 'sass', engine.syntax
|
32
|
+
end
|
33
|
+
|
34
|
+
should "default the output style to `nested`" do
|
35
|
+
assert_equal 'nested', subject.output_style
|
36
|
+
end
|
37
|
+
|
38
|
+
should "allow specifying a custom output style value" do
|
39
|
+
engine = Dassets::Sass::Engine.new(:output_style => 'compressed')
|
40
|
+
assert_equal 'compressed', engine.output_style
|
31
41
|
end
|
32
42
|
|
33
43
|
should "default the load paths to be just the source path" do
|
@@ -56,18 +66,21 @@ class Dassets::Sass::Engine
|
|
56
66
|
assert_equal 'css', subject.ext('whatever')
|
57
67
|
end
|
58
68
|
|
59
|
-
should "use its syntax and load paths when compiling" do
|
69
|
+
should "use its syntax, output style and load paths when compiling" do
|
60
70
|
compiled_with_options = false
|
61
71
|
input = @factory.sass
|
62
72
|
syntax = :sass
|
73
|
+
output_style = :compressed
|
63
74
|
sass_engine = Dassets::Sass::Engine.new({
|
64
75
|
:syntax => syntax,
|
76
|
+
:output_style => output_style,
|
65
77
|
:load_paths => [@lp1]
|
66
78
|
})
|
67
79
|
load_paths = sass_engine.load_paths
|
68
80
|
|
69
81
|
Assert.stub(::Sass, :compile).with(input, {
|
70
82
|
:syntax => syntax,
|
83
|
+
:style => output_style,
|
71
84
|
:load_paths => load_paths
|
72
85
|
}){ compiled_with_options = true }
|
73
86
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dassets-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2014-08-
|
19
|
+
date: 2014-08-11 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|