sassc-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sassc/rails/importer.rb +31 -2
- data/lib/sassc/rails/version.rb +1 -1
- data/test/dummy/app/assets/stylesheets/css_sass_handler.css.sass +2 -0
- data/test/dummy/app/assets/stylesheets/css_scss_handler.css.scss +3 -0
- data/test/dummy/app/assets/stylesheets/imports_test.scss +2 -0
- data/test/sassc_rails_test.rb +2 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e60f38f5df775c41f59d1a9677328525b562536
|
4
|
+
data.tar.gz: 0af45035536c57bfdef2dbd22e0dc3f6e0cc6f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce8812764596b6f3d86c4a78acb3f3e6a4442d84bb41ac1b7b1ecf7fc00e2ded2c9fa292058efaae70a64b2c17cf16b7ddc1d11e44ddca0d9bb67964da434b4b
|
7
|
+
data.tar.gz: 306fb2b06118f901b3006caa616874e247ed655864614950934622040d1ea5e9d09db97a854073ec217e651fdaaa3bec80768beaab25da00cdf05b389df3c31c
|
data/lib/sassc/rails/importer.rb
CHANGED
@@ -6,7 +6,7 @@ module SassC
|
|
6
6
|
class Extension
|
7
7
|
attr_reader :postfix
|
8
8
|
|
9
|
-
def initialize(postfix)
|
9
|
+
def initialize(postfix=nil)
|
10
10
|
@postfix = postfix
|
11
11
|
end
|
12
12
|
|
@@ -26,7 +26,34 @@ module SassC
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
class CssScssExtension < Extension
|
30
|
+
def postfix
|
31
|
+
".css.scss"
|
32
|
+
end
|
33
|
+
|
34
|
+
def import_for(original_path, parent_path, full_path, options)
|
35
|
+
source = File.open(full_path, 'rb') { |f| f.read }
|
36
|
+
SassC::Importer::Import.new(full_path, source: source)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class CssSassExtension < Extension
|
41
|
+
def postfix
|
42
|
+
".css.sass"
|
43
|
+
end
|
44
|
+
|
45
|
+
def import_for(original_path, parent_path, full_path, options)
|
46
|
+
sass = File.open(full_path, 'rb') { |f| f.read }
|
47
|
+
parsed_scss = SassC::Sass2Scss.convert(sass)
|
48
|
+
SassC::Importer::Import.new(full_path, source: parsed_scss)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
29
52
|
class SassERBExtension < Extension
|
53
|
+
def postfix
|
54
|
+
".sass.erb"
|
55
|
+
end
|
56
|
+
|
30
57
|
def import_for(original_path, parent_path, full_path, options)
|
31
58
|
template = Tilt::ERBTemplate.new(full_path)
|
32
59
|
parsed_erb = template.render(options[:sprockets][:context], {})
|
@@ -48,8 +75,10 @@ module SassC
|
|
48
75
|
Extension.new(".sass"),
|
49
76
|
CSSExtension.new,
|
50
77
|
ERBExtension.new(".scss.erb"),
|
51
|
-
SassERBExtension.new(".sass.erb"),
|
52
78
|
ERBExtension.new(".css.erb"),
|
79
|
+
SassERBExtension.new,
|
80
|
+
CssScssExtension.new,
|
81
|
+
CssSassExtension.new
|
53
82
|
]
|
54
83
|
|
55
84
|
PREFIXS = [ "", "_" ]
|
data/lib/sassc/rails/version.rb
CHANGED
data/test/sassc_rails_test.rb
CHANGED
@@ -118,6 +118,8 @@ class SassRailsTest < MiniTest::Test
|
|
118
118
|
assert_match /plain-old-css/, css_output
|
119
119
|
assert_match /another-plain-old-css/, css_output
|
120
120
|
assert_match /without-css-ext/, css_output
|
121
|
+
assert_match /css-scss-handler/, css_output
|
122
|
+
assert_match /css-sass-handler/, css_output
|
121
123
|
assert_match /css-erb-handler/, css_output
|
122
124
|
assert_match /scss-erb-handler/, css_output
|
123
125
|
assert_match /sass-erb-handler/, css_output
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
@@ -194,7 +194,9 @@ files:
|
|
194
194
|
- test/dummy/app/assets/stylesheets/css_application.css
|
195
195
|
- test/dummy/app/assets/stylesheets/css_erb_handler.css.erb
|
196
196
|
- test/dummy/app/assets/stylesheets/css_sass_erb_handler.sass.erb
|
197
|
+
- test/dummy/app/assets/stylesheets/css_sass_handler.css.sass
|
197
198
|
- test/dummy/app/assets/stylesheets/css_scss_erb_handler.scss.erb
|
199
|
+
- test/dummy/app/assets/stylesheets/css_scss_handler.css.scss
|
198
200
|
- test/dummy/app/assets/stylesheets/erb_render_with_context.css.erb
|
199
201
|
- test/dummy/app/assets/stylesheets/globbed/globbed.scss
|
200
202
|
- test/dummy/app/assets/stylesheets/globbed/nested/nested_glob.scss
|
@@ -463,7 +465,9 @@ test_files:
|
|
463
465
|
- test/dummy/app/assets/stylesheets/css_application.css
|
464
466
|
- test/dummy/app/assets/stylesheets/css_erb_handler.css.erb
|
465
467
|
- test/dummy/app/assets/stylesheets/css_sass_erb_handler.sass.erb
|
468
|
+
- test/dummy/app/assets/stylesheets/css_sass_handler.css.sass
|
466
469
|
- test/dummy/app/assets/stylesheets/css_scss_erb_handler.scss.erb
|
470
|
+
- test/dummy/app/assets/stylesheets/css_scss_handler.css.scss
|
467
471
|
- test/dummy/app/assets/stylesheets/erb_render_with_context.css.erb
|
468
472
|
- test/dummy/app/assets/stylesheets/globbed/globbed.scss
|
469
473
|
- test/dummy/app/assets/stylesheets/globbed/nested/nested_glob.scss
|