sassc-rails 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -9
- data/lib/sassc/rails/template.rb +7 -0
- data/lib/sassc/rails/version.rb +1 -1
- data/test/sassc_rails_test.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97b9a953b7c0b8748c8dcc5a229f89b17ba5d3d6
|
4
|
+
data.tar.gz: b8d3e479d97350437c3a9bd377743c269506b138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26da3ff42d66b5ef27af22d1926c6a0b2fadd0f3ba991509a1137a069ae404a55d7b1f368341ad52ccc28a58b89052a17b75d65784baec32f149f3c554091df9
|
7
|
+
data.tar.gz: f2124399e1fb25354b89373d5adf95b6f68ed3c5f6b653531adb0ca988cb785a3794f7531e90e774bc8479d0c6b209bebcc7079baa3fd596a3bafd64e7e1379a
|
data/README.md
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
# SassC::Rails [![Build Status](https://travis-ci.org/bolandrm/sassc-rails.svg)](https://travis-ci.org/bolandrm/sassc-rails) [![Gem Version](https://badge.fury.io/rb/sassc-rails.svg)](http://badge.fury.io/rb/sassc-rails)
|
2
2
|
|
3
|
-
|
3
|
+
We all love working with Sass, but compilation can take quite a long time for larger
|
4
|
+
codebases. This gem integrates the C implementation of Sass,
|
5
|
+
[libsass](https://github.com/sass/libsass), into the asset pipeline.
|
6
|
+
|
7
|
+
In one larger project, this made compilation 4x faster:
|
8
|
+
|
9
|
+
```
|
10
|
+
# Using sassc-rails
|
11
|
+
|
12
|
+
[1] pry(main)> Benchmark.bm { |bm| bm.report { Rails.application.assets["application.css"] } }
|
13
|
+
user system total real
|
14
|
+
1.720000 0.170000 1.890000 ( 1.936867)
|
15
|
+
|
16
|
+
# Using sass-rails
|
17
|
+
|
18
|
+
[1] pry(main)> Benchmark.bm { |bm| bm.report { Rails.application.assets["application.css"] } }
|
19
|
+
user system total real
|
20
|
+
7.820000 0.250000 8.070000 ( 8.106347)
|
21
|
+
```
|
22
|
+
|
23
|
+
This should essentially be a drop in alternative to [sass-rails](https://github.com/rails/sass-rails).
|
24
|
+
|
25
|
+
__Note: This is a new project, please report any issues you come across!__
|
4
26
|
|
5
27
|
## Installation
|
6
28
|
|
@@ -15,14 +37,16 @@ And then execute:
|
|
15
37
|
$ bundle
|
16
38
|
|
17
39
|
|
18
|
-
## Usage
|
19
|
-
|
20
|
-
TODO: Write usage instructions here
|
21
|
-
|
22
40
|
## Contributing
|
23
41
|
|
24
42
|
1. Fork it ( https://github.com/[my-github-username]/sassc-rails/fork )
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
43
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
1. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
1. Add Tests
|
46
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
1. Create a new Pull Request
|
48
|
+
|
49
|
+
## Credits
|
50
|
+
|
51
|
+
This gem is based on [sass-rails](https://github.com/rails/sass-rails), and
|
52
|
+
is maintained by [Ryan Boland](https://ryanboland.com).
|
data/lib/sassc/rails/template.rb
CHANGED
@@ -13,6 +13,7 @@ module SassC::Rails
|
|
13
13
|
syntax: self.class.syntax,
|
14
14
|
load_paths: input[:environment].paths,
|
15
15
|
importer: SassC::Rails::Importer,
|
16
|
+
style: sass_style,
|
16
17
|
sprockets: {
|
17
18
|
context: context,
|
18
19
|
environment: input[:environment],
|
@@ -43,6 +44,7 @@ module SassC::Rails
|
|
43
44
|
syntax: syntax,
|
44
45
|
load_paths: context.environment.paths,
|
45
46
|
importer: SassC::Rails::Importer,
|
47
|
+
style: sass_style,
|
46
48
|
sprockets: {
|
47
49
|
context: context,
|
48
50
|
environment: context.environment
|
@@ -58,6 +60,11 @@ module SassC::Rails
|
|
58
60
|
else
|
59
61
|
include Sprockets2
|
60
62
|
end
|
63
|
+
|
64
|
+
def sass_style
|
65
|
+
style = Rails.application.config.sass.style || :expanded
|
66
|
+
"sass_style_#{style}".to_sym
|
67
|
+
end
|
61
68
|
end
|
62
69
|
|
63
70
|
class ScssTemplate < SassTemplate
|
data/lib/sassc/rails/version.rb
CHANGED
data/test/sassc_rails_test.rb
CHANGED
@@ -30,6 +30,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def initialize!
|
33
|
+
Rails.env = "test"
|
33
34
|
@app.initialize!
|
34
35
|
end
|
35
36
|
|
@@ -44,13 +45,14 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def test_setup_works
|
47
|
-
|
48
|
+
initialize_dev!
|
48
49
|
|
49
50
|
asset = render_asset("application.scss")
|
50
51
|
|
51
52
|
assert_equal <<-CSS, asset
|
52
53
|
.hello {
|
53
|
-
color: #FFF;
|
54
|
+
color: #FFF;
|
55
|
+
}
|
54
56
|
CSS
|
55
57
|
end
|
56
58
|
|
@@ -166,7 +168,12 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
166
168
|
end
|
167
169
|
|
168
170
|
def test_compression_works
|
169
|
-
|
171
|
+
initialize_prod!
|
172
|
+
|
173
|
+
asset = render_asset("application.scss")
|
174
|
+
assert_equal <<-CSS, asset
|
175
|
+
.hello{color:#FFF}
|
176
|
+
CSS
|
170
177
|
end
|
171
178
|
|
172
179
|
#test 'sprockets require works correctly' do
|