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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcda473ec02c97dd9a753b7bf85efe4cfbc32e96
4
- data.tar.gz: db721d0f683ec7a5d7626044e6e4b14220c5a29f
3
+ metadata.gz: 5e60f38f5df775c41f59d1a9677328525b562536
4
+ data.tar.gz: 0af45035536c57bfdef2dbd22e0dc3f6e0cc6f45
5
5
  SHA512:
6
- metadata.gz: 59d3ff0498cecea7d03e1d3d8ce33aeabc50d3f9a14bfe079a4988626f94837acc4f0a72d3329ddd2b9f678ac343d3a894a6f2f3e6a93c4a8fc6c7cff4b891db
7
- data.tar.gz: c05d5c0e5ba4dabc4df2436ca16e445f8c6c1961601e52b7c98bdc18413c81edb95277c7a2148f1dc394d98971759058ddbc93d22967a98e9ee27b1d575c83de
6
+ metadata.gz: ce8812764596b6f3d86c4a78acb3f3e6a4442d84bb41ac1b7b1ecf7fc00e2ded2c9fa292058efaae70a64b2c17cf16b7ddc1d11e44ddca0d9bb67964da434b4b
7
+ data.tar.gz: 306fb2b06118f901b3006caa616874e247ed655864614950934622040d1ea5e9d09db97a854073ec217e651fdaaa3bec80768beaab25da00cdf05b389df3c31c
@@ -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 = [ "", "_" ]
@@ -1,5 +1,5 @@
1
1
  module SassC
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -0,0 +1,2 @@
1
+ .css-sass-handler
2
+ color: blue
@@ -0,0 +1,3 @@
1
+ .css-scss-handler {
2
+ color: yellow;
3
+ }
@@ -8,6 +8,8 @@
8
8
  @import "css_erb_handler";
9
9
  @import "scss_erb_handler";
10
10
  @import "sass_erb_handler";
11
+ @import "css_scss_handler";
12
+ @import "css_sass_handler";
11
13
  @import "css_scss_erb_handler";
12
14
  @import "css_sass_erb_handler";
13
15
 
@@ -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.2
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