sass-rails 4.0.5 → 5.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -16
- data/lib/rails/generators/sass/assets/assets_generator.rb +1 -1
- data/lib/rails/generators/sass_scaffold.rb +1 -2
- data/lib/rails/generators/scss/assets/assets_generator.rb +1 -1
- data/lib/sass/rails/cache_store.rb +31 -0
- data/lib/sass/rails/helpers.rb +4 -21
- data/lib/sass/rails/importer.rb +123 -86
- data/lib/sass/rails/logger.rb +1 -0
- data/lib/sass/rails/railtie.rb +34 -11
- data/lib/sass/rails/template.rb +67 -23
- data/lib/sass/rails/version.rb +1 -1
- metadata +33 -250
- data/.gitignore +0 -6
- data/.travis.yml +0 -25
- data/CHANGELOG.md +0 -57
- data/Gemfile +0 -4
- data/Rakefile +0 -28
- data/sass-rails.gemspec +0 -29
- data/sass-rails.gemspec.erb +0 -29
- data/test/fixtures/alternate_config_project/.gitignore +0 -5
- data/test/fixtures/alternate_config_project/Gemfile +0 -7
- data/test/fixtures/alternate_config_project/README +0 -261
- data/test/fixtures/alternate_config_project/Rakefile +0 -7
- data/test/fixtures/alternate_config_project/app/assets/images/1x1.png +0 -0
- data/test/fixtures/alternate_config_project/app/assets/images/rails.png +0 -0
- data/test/fixtures/alternate_config_project/app/assets/javascripts/application.js +0 -9
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/_top_level_partial.css.scss +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/application.css.scss +0 -32
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/css_application.css +0 -7
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/globbed/globbed.css.scss +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/globbed/nested/nested_glob.css.scss +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_sass_import.css.sass +0 -5
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_scss_import.css.scss +0 -9
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_without_css_ext.scss +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/_relative_sass.css.sass +0 -2
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/_relative_scss.css.scss +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/another_plain.css +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/plain.css +0 -3
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/second_level.css.scss +0 -1
- data/test/fixtures/alternate_config_project/app/controllers/application_controller.rb +0 -3
- data/test/fixtures/alternate_config_project/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/alternate_config_project/app/mailers/.gitkeep +0 -0
- data/test/fixtures/alternate_config_project/app/models/.gitkeep +0 -0
- data/test/fixtures/alternate_config_project/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/alternate_config_project/config/application.rb +0 -49
- data/test/fixtures/alternate_config_project/config/boot.rb +0 -6
- data/test/fixtures/alternate_config_project/config/database.yml +0 -25
- data/test/fixtures/alternate_config_project/config/environment.rb +0 -5
- data/test/fixtures/alternate_config_project/config/environments/development.rb +0 -27
- data/test/fixtures/alternate_config_project/config/environments/production.rb +0 -56
- data/test/fixtures/alternate_config_project/config/environments/test.rb +0 -38
- data/test/fixtures/alternate_config_project/config/initializers/backtrace_silencers.rb +0 -7
- data/test/fixtures/alternate_config_project/config/initializers/inflections.rb +0 -10
- data/test/fixtures/alternate_config_project/config/initializers/mime_types.rb +0 -5
- data/test/fixtures/alternate_config_project/config/initializers/secret_token.rb +0 -7
- data/test/fixtures/alternate_config_project/config/initializers/session_store.rb +0 -8
- data/test/fixtures/alternate_config_project/config/initializers/wrap_parameters.rb +0 -12
- data/test/fixtures/alternate_config_project/config/locales/en.yml +0 -5
- data/test/fixtures/alternate_config_project/config/routes.rb +0 -58
- data/test/fixtures/alternate_config_project/config.ru +0 -4
- data/test/fixtures/alternate_config_project/db/seeds.rb +0 -7
- data/test/fixtures/alternate_config_project/doc/README_FOR_APP +0 -2
- data/test/fixtures/alternate_config_project/lib/tasks/.gitkeep +0 -0
- data/test/fixtures/alternate_config_project/log/.gitkeep +0 -0
- data/test/fixtures/alternate_config_project/public/404.html +0 -26
- data/test/fixtures/alternate_config_project/public/422.html +0 -26
- data/test/fixtures/alternate_config_project/public/500.html +0 -26
- data/test/fixtures/alternate_config_project/public/favicon.ico +0 -0
- data/test/fixtures/alternate_config_project/public/index.html +0 -241
- data/test/fixtures/alternate_config_project/public/robots.txt +0 -5
- data/test/fixtures/alternate_config_project/script/rails +0 -6
- data/test/fixtures/alternate_config_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/fixtures/alternate_config_project/vendor/plugins/.gitkeep +0 -0
- data/test/fixtures/engine_project/.gitignore +0 -8
- data/test/fixtures/engine_project/Gemfile +0 -14
- data/test/fixtures/engine_project/MIT-LICENSE +0 -20
- data/test/fixtures/engine_project/README.rdoc +0 -3
- data/test/fixtures/engine_project/Rakefile +0 -34
- data/test/fixtures/engine_project/app/assets/images/engine_project/.keep +0 -0
- data/test/fixtures/engine_project/app/assets/javascripts/engine_project/application.js +0 -16
- data/test/fixtures/engine_project/app/assets/stylesheets/engine_project/application.css +0 -13
- data/test/fixtures/engine_project/app/controllers/engine_project/application_controller.rb +0 -4
- data/test/fixtures/engine_project/app/helpers/engine_project/application_helper.rb +0 -4
- data/test/fixtures/engine_project/app/views/layouts/engine_project/application.html.erb +0 -14
- data/test/fixtures/engine_project/config/routes.rb +0 -2
- data/test/fixtures/engine_project/engine_project.gemspec +0 -23
- data/test/fixtures/engine_project/lib/engine_project/engine.rb +0 -5
- data/test/fixtures/engine_project/lib/engine_project/version.rb +0 -3
- data/test/fixtures/engine_project/lib/engine_project.rb +0 -4
- data/test/fixtures/engine_project/lib/tasks/engine_project_tasks.rake +0 -4
- data/test/fixtures/engine_project/script/rails +0 -8
- data/test/fixtures/engine_project/test/dummy/README.rdoc +0 -28
- data/test/fixtures/engine_project/test/dummy/Rakefile +0 -6
- data/test/fixtures/engine_project/test/dummy/app/assets/javascripts/application.js +0 -16
- data/test/fixtures/engine_project/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/fixtures/engine_project/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/fixtures/engine_project/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/fixtures/engine_project/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/engine_project/test/dummy/app/mailers/.keep +0 -0
- data/test/fixtures/engine_project/test/dummy/app/models/.keep +0 -0
- data/test/fixtures/engine_project/test/dummy/app/models/concerns/.keep +0 -0
- data/test/fixtures/engine_project/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/engine_project/test/dummy/bin/bundle +0 -3
- data/test/fixtures/engine_project/test/dummy/bin/rails +0 -4
- data/test/fixtures/engine_project/test/dummy/bin/rake +0 -4
- data/test/fixtures/engine_project/test/dummy/config/application.rb +0 -23
- data/test/fixtures/engine_project/test/dummy/config/boot.rb +0 -9
- data/test/fixtures/engine_project/test/dummy/config/database.yml +0 -25
- data/test/fixtures/engine_project/test/dummy/config/environment.rb +0 -5
- data/test/fixtures/engine_project/test/dummy/config/environments/development.rb +0 -27
- data/test/fixtures/engine_project/test/dummy/config/environments/production.rb +0 -80
- data/test/fixtures/engine_project/test/dummy/config/environments/test.rb +0 -36
- data/test/fixtures/engine_project/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/fixtures/engine_project/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/fixtures/engine_project/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/fixtures/engine_project/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/fixtures/engine_project/test/dummy/config/initializers/secret_token.rb +0 -12
- data/test/fixtures/engine_project/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/fixtures/engine_project/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/fixtures/engine_project/test/dummy/config/locales/en.yml +0 -23
- data/test/fixtures/engine_project/test/dummy/config/routes.rb +0 -4
- data/test/fixtures/engine_project/test/dummy/config.ru +0 -4
- data/test/fixtures/engine_project/test/dummy/lib/assets/.keep +0 -0
- data/test/fixtures/engine_project/test/dummy/log/.keep +0 -0
- data/test/fixtures/engine_project/test/dummy/public/404.html +0 -27
- data/test/fixtures/engine_project/test/dummy/public/422.html +0 -26
- data/test/fixtures/engine_project/test/dummy/public/500.html +0 -26
- data/test/fixtures/engine_project/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/sass_project/.gitignore +0 -5
- data/test/fixtures/sass_project/Gemfile +0 -7
- data/test/fixtures/sass_project/README +0 -261
- data/test/fixtures/sass_project/Rakefile +0 -7
- data/test/fixtures/sass_project/app/assets/images/rails.png +0 -0
- data/test/fixtures/sass_project/app/assets/javascripts/application.js +0 -9
- data/test/fixtures/sass_project/app/assets/stylesheets/application.css +0 -7
- data/test/fixtures/sass_project/app/controllers/application_controller.rb +0 -3
- data/test/fixtures/sass_project/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/sass_project/app/mailers/.gitkeep +0 -0
- data/test/fixtures/sass_project/app/models/.gitkeep +0 -0
- data/test/fixtures/sass_project/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/sass_project/config/application.rb +0 -52
- data/test/fixtures/sass_project/config/boot.rb +0 -6
- data/test/fixtures/sass_project/config/database.yml +0 -25
- data/test/fixtures/sass_project/config/environment.rb +0 -5
- data/test/fixtures/sass_project/config/environments/development.rb +0 -21
- data/test/fixtures/sass_project/config/environments/production.rb +0 -51
- data/test/fixtures/sass_project/config/environments/test.rb +0 -36
- data/test/fixtures/sass_project/config/initializers/backtrace_silencers.rb +0 -7
- data/test/fixtures/sass_project/config/initializers/inflections.rb +0 -10
- data/test/fixtures/sass_project/config/initializers/mime_types.rb +0 -5
- data/test/fixtures/sass_project/config/initializers/secret_token.rb +0 -7
- data/test/fixtures/sass_project/config/initializers/session_store.rb +0 -8
- data/test/fixtures/sass_project/config/initializers/wrap_parameters.rb +0 -12
- data/test/fixtures/sass_project/config/locales/en.yml +0 -5
- data/test/fixtures/sass_project/config/routes.rb +0 -58
- data/test/fixtures/sass_project/config.ru +0 -4
- data/test/fixtures/sass_project/db/seeds.rb +0 -7
- data/test/fixtures/sass_project/doc/README_FOR_APP +0 -2
- data/test/fixtures/sass_project/lib/tasks/.gitkeep +0 -0
- data/test/fixtures/sass_project/log/.gitkeep +0 -0
- data/test/fixtures/sass_project/public/404.html +0 -26
- data/test/fixtures/sass_project/public/422.html +0 -26
- data/test/fixtures/sass_project/public/500.html +0 -26
- data/test/fixtures/sass_project/public/favicon.ico +0 -0
- data/test/fixtures/sass_project/public/index.html +0 -241
- data/test/fixtures/sass_project/public/robots.txt +0 -5
- data/test/fixtures/sass_project/script/rails +0 -6
- data/test/fixtures/sass_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/fixtures/sass_project/vendor/plugins/.gitkeep +0 -0
- data/test/fixtures/scss_project/.gitignore +0 -5
- data/test/fixtures/scss_project/Gemfile +0 -7
- data/test/fixtures/scss_project/README +0 -261
- data/test/fixtures/scss_project/Rakefile +0 -7
- data/test/fixtures/scss_project/app/assets/images/1x1.png +0 -0
- data/test/fixtures/scss_project/app/assets/images/rails.png +0 -0
- data/test/fixtures/scss_project/app/assets/javascripts/application.js +0 -9
- data/test/fixtures/scss_project/app/assets/stylesheets/_top_level_partial.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/application.css.scss +0 -37
- data/test/fixtures/scss_project/app/assets/stylesheets/css_application.css +0 -7
- data/test/fixtures/scss_project/app/assets/stylesheets/css_erb_handler.css.erb +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/css_sass_erb_handler.css.sass.erb +0 -2
- data/test/fixtures/scss_project/app/assets/stylesheets/css_scss_erb_handler.css.scss.erb +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/globbed/globbed.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/globbed/nested/nested_glob.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/_sass_import.css.sass +0 -5
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/_scss_import.css.scss +0 -9
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/_without_css_ext.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/_relative_sass.css.sass +0 -2
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/_relative_scss.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/sass_erb_handler.sass.erb +0 -2
- data/test/fixtures/scss_project/app/assets/stylesheets/scss_erb_handler.scss.erb +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/_defaults.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/another_plain.css +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/plain.css +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/second_level.css.scss +0 -2
- data/test/fixtures/scss_project/app/controllers/application_controller.rb +0 -3
- data/test/fixtures/scss_project/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/scss_project/app/mailers/.gitkeep +0 -0
- data/test/fixtures/scss_project/app/models/.gitkeep +0 -0
- data/test/fixtures/scss_project/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/scss_project/config/application.rb +0 -49
- data/test/fixtures/scss_project/config/boot.rb +0 -6
- data/test/fixtures/scss_project/config/database.yml +0 -25
- data/test/fixtures/scss_project/config/environment.rb +0 -5
- data/test/fixtures/scss_project/config/environments/development.rb +0 -23
- data/test/fixtures/scss_project/config/environments/production.rb +0 -53
- data/test/fixtures/scss_project/config/environments/test.rb +0 -38
- data/test/fixtures/scss_project/config/initializers/backtrace_silencers.rb +0 -7
- data/test/fixtures/scss_project/config/initializers/inflections.rb +0 -10
- data/test/fixtures/scss_project/config/initializers/mime_types.rb +0 -5
- data/test/fixtures/scss_project/config/initializers/postprocessor.rb +0 -3
- data/test/fixtures/scss_project/config/initializers/secret_token.rb +0 -7
- data/test/fixtures/scss_project/config/initializers/session_store.rb +0 -8
- data/test/fixtures/scss_project/config/initializers/wrap_parameters.rb +0 -12
- data/test/fixtures/scss_project/config/locales/en.yml +0 -5
- data/test/fixtures/scss_project/config/routes.rb +0 -58
- data/test/fixtures/scss_project/config.ru +0 -4
- data/test/fixtures/scss_project/db/seeds.rb +0 -7
- data/test/fixtures/scss_project/doc/README_FOR_APP +0 -2
- data/test/fixtures/scss_project/lib/tasks/.gitkeep +0 -0
- data/test/fixtures/scss_project/log/.gitkeep +0 -0
- data/test/fixtures/scss_project/public/404.html +0 -26
- data/test/fixtures/scss_project/public/422.html +0 -26
- data/test/fixtures/scss_project/public/500.html +0 -26
- data/test/fixtures/scss_project/public/favicon.ico +0 -0
- data/test/fixtures/scss_project/public/index.html +0 -241
- data/test/fixtures/scss_project/public/robots.txt +0 -5
- data/test/fixtures/scss_project/script/rails +0 -6
- data/test/fixtures/scss_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/fixtures/scss_project/vendor/plugins/.gitkeep +0 -0
- data/test/gemfiles/Gemfile-rails-4-0 +0 -6
- data/test/gemfiles/Gemfile-rails-4-1 +0 -6
- data/test/gemfiles/Gemfile-sprockets-2-11 +0 -6
- data/test/gemfiles/Gemfile-sprockets-2-12 +0 -6
- data/test/gemfiles/Gemfile-sprockets-2-8 +0 -6
- data/test/sass_rails_generators_test.rb +0 -62
- data/test/sass_rails_logger_test.rb +0 -24
- data/test/sass_rails_test.rb +0 -133
- data/test/support/sass_rails_test_case.rb +0 -166
- data/test/test_helper.rb +0 -25
- /data/lib/rails/generators/sass/assets/templates/{stylesheet.css.sass → stylesheet.sass} +0 -0
- /data/lib/rails/generators/scss/assets/templates/{stylesheet.css.scss → stylesheet.scss} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc20cc8a698a7c1e645a39e3f938c007aa50acdf
|
4
|
+
data.tar.gz: 58038028760c974e11a7fdff1cfbd1b2e7eeb9d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a78ea099aa7b2bee1a24e922aa70899216093b720c97fbc4906c96b55e2d15eba0c9e10e867459ef95f5c992207577a401468389ef8424acfe43bb1a4379391a
|
7
|
+
data.tar.gz: b000b620f75fab1098032f95fa4a4baafe5a541c3c47c1e96bcacd989d04f3d09da7b6c7b13c6d839bbb3297f4520ff527c864ef7de9f633097a41b43d65b7ed
|
data/README.md
CHANGED
@@ -16,20 +16,23 @@ properties that will be passed to Sass.
|
|
16
16
|
|
17
17
|
### Options
|
18
18
|
|
19
|
-
|
19
|
+
- `preferred_syntax` - This option determines the default Sass syntax and file extensions that will be used by Rails generators. Can be `:scss` (default CSS-compatible SCSS syntax) or `:sass` (indented Sass syntax).
|
20
|
+
|
21
|
+
The [list of supported Sass options](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#options)
|
20
22
|
can be found on the Sass Website with the following caveats:
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
- `:style` - This option is not supported. This is determined by the Rails environment. It's `:expanded` only on development, otherwise it's `:compressed`.
|
25
|
+
- `:never_update` - This option is not supported. Instead set `config.assets.enabled = false`
|
26
|
+
- `:always_update` - This option is not supported. Sprockets uses a controller to access stylesheets in development mode instead of a full scan for changed files.
|
27
|
+
- `:always_check` - This option is not supported. Sprockets always checks in development.
|
28
|
+
- `:syntax` - This is determined by the file's extensions.
|
29
|
+
- `:filename` - This is determined by the file's name.
|
30
|
+
- `:line` - This is provided by the template handler.
|
29
31
|
|
30
32
|
### Example
|
31
33
|
|
32
34
|
MyProject::Application.configure do
|
35
|
+
config.sass.preferred_syntax = :sass
|
33
36
|
config.sass.line_comments = false
|
34
37
|
config.sass.cache = false
|
35
38
|
end
|
@@ -65,24 +68,24 @@ in Sass):
|
|
65
68
|
#### `asset-path($relative-asset-path)`
|
66
69
|
Returns a string to the asset.
|
67
70
|
|
68
|
-
* `asset-path("rails.png")`
|
71
|
+
* `asset-path("rails.png")` returns `"/assets/rails.png"`
|
69
72
|
|
70
73
|
#### `asset-url($relative-asset-path)`
|
71
74
|
Returns a url reference to the asset.
|
72
75
|
|
73
|
-
* `asset-url("rails.png")`
|
76
|
+
* `asset-url("rails.png")` returns `url(/assets/rails.png)`
|
74
77
|
|
75
78
|
As a convenience, for each of the following asset classes there are
|
76
79
|
corresponding `-path` and `-url` helpers:
|
77
80
|
image, font, video, audio, javascript, stylesheet.
|
78
81
|
|
79
|
-
* `image-path("rails.png")`
|
80
|
-
* `image-url("rails.png")`
|
82
|
+
* `image-path("rails.png")` returns `"/assets/rails.png"`
|
83
|
+
* `image-url("rails.png")` returns `url(/assets/rails.png)`
|
81
84
|
|
82
85
|
#### `asset-data-url($relative-asset-path)`
|
83
86
|
Returns a url reference to the Base64-encoded asset at the specified path.
|
84
87
|
|
85
|
-
* `asset-data-url("rails.png")`
|
88
|
+
* `asset-data-url("rails.png")` returns `url(data:image/png;base64,iVBORw0K...)`
|
86
89
|
|
87
90
|
## Running Tests
|
88
91
|
|
@@ -93,6 +96,6 @@ If you need to test against local gems, use Bundler's gem :path option in the Ge
|
|
93
96
|
|
94
97
|
## Code Status
|
95
98
|
|
96
|
-
* [![Travis CI](https://api.travis-ci.org/rails/sass-rails.
|
97
|
-
* [![Gem Version](https://badge.fury.io/rb/sass-rails.
|
98
|
-
* [![Dependencies](https://gemnasium.com/rails/sass-rails.
|
99
|
+
* [![Travis CI](https://api.travis-ci.org/rails/sass-rails.svg)](http://travis-ci.org/rails/sass-rails)
|
100
|
+
* [![Gem Version](https://badge.fury.io/rb/sass-rails.svg)](http://badge.fury.io/rb/sass-rails)
|
101
|
+
* [![Dependencies](https://gemnasium.com/rails/sass-rails.svg)](https://gemnasium.com/rails/sass-rails)
|
@@ -6,7 +6,7 @@ module Sass
|
|
6
6
|
source_root File.expand_path("../templates", __FILE__)
|
7
7
|
|
8
8
|
def copy_sass
|
9
|
-
template "stylesheet.
|
9
|
+
template "stylesheet.sass", File.join('app/assets/stylesheets', class_path, "#{file_name}.sass")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -8,9 +8,8 @@ module Sass
|
|
8
8
|
dir = ::Rails::Generators::ScaffoldGenerator.source_root
|
9
9
|
file = File.join(dir, "scaffold.css")
|
10
10
|
converted_contents = ::Sass::CSS.new(File.read(file)).render(syntax)
|
11
|
-
create_file "app/assets/stylesheets/scaffolds
|
11
|
+
create_file "app/assets/stylesheets/scaffolds.#{syntax}", converted_contents
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
@@ -6,7 +6,7 @@ module Scss
|
|
6
6
|
source_root File.expand_path("../templates", __FILE__)
|
7
7
|
|
8
8
|
def copy_scss
|
9
|
-
template "stylesheet.
|
9
|
+
template "stylesheet.scss", File.join('app/assets/stylesheets', class_path, "#{file_name}.scss")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'sass'
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
module Rails
|
5
|
+
class CacheStore < ::Sass::CacheStores::Base
|
6
|
+
attr_reader :environment
|
7
|
+
|
8
|
+
def initialize(environment)
|
9
|
+
@environment = environment
|
10
|
+
end
|
11
|
+
|
12
|
+
def _store(key, version, sha, contents)
|
13
|
+
environment.cache_set("sass/#{key}", {:version => version, :sha => sha, :contents => contents})
|
14
|
+
end
|
15
|
+
|
16
|
+
def _retrieve(key, version, sha)
|
17
|
+
if obj = environment.cache_get("sass/#{key}")
|
18
|
+
return unless obj[:version] == version
|
19
|
+
return unless obj[:sha] == sha
|
20
|
+
obj[:contents]
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def path_to(key)
|
27
|
+
key
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/sass/rails/helpers.rb
CHANGED
@@ -1,30 +1,13 @@
|
|
1
|
+
require 'sass'
|
1
2
|
require 'sprockets/sass_functions'
|
2
|
-
require 'active_support/deprecation'
|
3
3
|
|
4
4
|
module Sprockets
|
5
5
|
module SassFunctions
|
6
|
-
if
|
7
|
-
undef_method :asset_path
|
8
|
-
end
|
9
|
-
|
10
|
-
def asset_path(path, kind = nil)
|
11
|
-
ActiveSupport::Deprecation.warn "asset_path with two arguments is deprecated. Use asset_path(#{path}) instead." if kind
|
12
|
-
|
13
|
-
Sass::Script::String.new(sprockets_context.asset_path(path.value), :string)
|
14
|
-
end
|
15
|
-
|
16
|
-
if instance_methods.map(&:to_sym).include?(:asset_url)
|
17
|
-
undef_method :asset_url
|
18
|
-
end
|
19
|
-
|
20
|
-
def asset_url(path, kind = nil)
|
21
|
-
ActiveSupport::Deprecation.warn "asset_url with two arguments is deprecated. Use asset_url(#{path}) instead." if kind
|
22
|
-
|
23
|
-
Sass::Script::String.new("url(" + sprockets_context.asset_path(path.value) + ")")
|
24
|
-
end
|
25
|
-
|
6
|
+
remove_method :asset_data_url if method_defined?(:asset_data_url)
|
26
7
|
def asset_data_url(path)
|
27
8
|
Sass::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
|
28
9
|
end
|
29
10
|
end
|
30
11
|
end
|
12
|
+
|
13
|
+
::Sass::Script::Functions.send :include, Sprockets::SassFunctions
|
data/lib/sass/rails/importer.rb
CHANGED
@@ -1,110 +1,147 @@
|
|
1
|
+
require 'active_support/deprecation/reporting'
|
1
2
|
require 'sass'
|
2
3
|
require 'sprockets/sass_importer'
|
4
|
+
require 'tilt'
|
5
|
+
|
6
|
+
module Sass
|
7
|
+
module Rails
|
8
|
+
class SassImporter < Sass::Importers::Filesystem
|
9
|
+
module Globbing
|
10
|
+
GLOB = /(\A|\/)(\*|\*\*\/\*)\z/
|
11
|
+
|
12
|
+
def find_relative(name, base, options)
|
13
|
+
if options[:sprockets] && m = name.match(GLOB)
|
14
|
+
path = name.sub(m[0], "")
|
15
|
+
base = File.expand_path(path, File.dirname(base))
|
16
|
+
glob_imports(base, m[2], options)
|
17
|
+
else
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
3
21
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
private :context
|
10
|
-
|
11
|
-
def initialize(context, root)
|
12
|
-
@context = context
|
13
|
-
super root.to_s
|
14
|
-
end
|
15
|
-
|
16
|
-
def extensions
|
17
|
-
{
|
18
|
-
'css' => :scss,
|
19
|
-
'css.scss' => :scss,
|
20
|
-
'css.sass' => :sass,
|
21
|
-
'css.erb' => :scss,
|
22
|
-
'scss.erb' => :scss,
|
23
|
-
'sass.erb' => :sass,
|
24
|
-
'css.scss.erb' => :scss,
|
25
|
-
'css.sass.erb' => :sass
|
26
|
-
}.merge!(super)
|
27
|
-
end
|
22
|
+
def find(name, options)
|
23
|
+
# globs must be relative
|
24
|
+
return if name =~ GLOB
|
25
|
+
super
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
private
|
29
|
+
def glob_imports(base, glob, options)
|
30
|
+
contents = ""
|
31
|
+
context = options[:sprockets][:context]
|
32
|
+
each_globbed_file(base, glob, context) do |filename|
|
33
|
+
next if filename == options[:filename]
|
34
|
+
contents << "@import #{filename.inspect};\n"
|
35
|
+
end
|
36
|
+
return nil if contents == ""
|
37
|
+
Sass::Engine.new(contents, options.merge(
|
38
|
+
:filename => base,
|
39
|
+
:importer => self,
|
40
|
+
:syntax => :scss
|
41
|
+
))
|
42
|
+
end
|
43
|
+
|
44
|
+
def each_globbed_file(base, glob, context)
|
45
|
+
raise ArgumentError unless glob == "*" || glob == "**/*"
|
46
|
+
|
47
|
+
exts = extensions.keys.map { |ext| Regexp.escape(".#{ext}") }.join("|")
|
48
|
+
sass_re = Regexp.compile("(#{exts})$")
|
49
|
+
|
50
|
+
context.depend_on(base)
|
51
|
+
|
52
|
+
Dir["#{base}/#{glob}"].sort.each do |path|
|
53
|
+
if File.directory?(path)
|
54
|
+
context.depend_on(path)
|
55
|
+
elsif sass_re =~ path
|
56
|
+
yield path
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
34
60
|
end
|
35
|
-
end
|
36
61
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
62
|
+
module ERB
|
63
|
+
def extensions
|
64
|
+
{
|
65
|
+
'css.erb' => :scss_erb,
|
66
|
+
'scss.erb' => :scss_erb,
|
67
|
+
'sass.erb' => :sass_erb
|
68
|
+
}.merge(super)
|
69
|
+
end
|
44
70
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
71
|
+
def erb_extensions
|
72
|
+
{
|
73
|
+
:scss_erb => :scss,
|
74
|
+
:sass_erb => :sass
|
75
|
+
}
|
76
|
+
end
|
51
77
|
|
52
|
-
|
53
|
-
|
54
|
-
each_globbed_file(glob, base_pathname.dirname, options) do |filename|
|
55
|
-
if File.directory?(filename)
|
56
|
-
depend_on(filename)
|
57
|
-
elsif context.asset_requirable?(filename)
|
58
|
-
depend_on(filename)
|
59
|
-
contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
|
78
|
+
def find_relative(*args)
|
79
|
+
process_erb_engine(super)
|
60
80
|
end
|
61
|
-
end
|
62
|
-
return nil if contents.empty?
|
63
|
-
Sass::Engine.new(contents, options.merge(
|
64
|
-
:filename => base_pathname.to_s,
|
65
|
-
:importer => self,
|
66
|
-
:syntax => :scss
|
67
|
-
))
|
68
|
-
end
|
69
81
|
|
70
|
-
|
82
|
+
def find(*args)
|
83
|
+
process_erb_engine(super)
|
84
|
+
end
|
71
85
|
|
72
|
-
|
73
|
-
|
74
|
-
|
86
|
+
private
|
87
|
+
def process_erb_engine(engine)
|
88
|
+
if engine && engine.options[:sprockets] && syntax = erb_extensions[engine.options[:syntax]]
|
89
|
+
template = Tilt::ERBTemplate.new(engine.options[:filename])
|
90
|
+
contents = template.render(engine.options[:sprockets][:context], {})
|
91
|
+
|
92
|
+
Sass::Engine.new(contents, engine.options.merge(:syntax => syntax))
|
93
|
+
else
|
94
|
+
engine
|
95
|
+
end
|
96
|
+
end
|
75
97
|
end
|
76
98
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
99
|
+
module Deprecated
|
100
|
+
def extensions
|
101
|
+
{
|
102
|
+
'css.scss' => :scss,
|
103
|
+
'css.sass' => :sass,
|
104
|
+
'css.scss.erb' => :scss_erb,
|
105
|
+
'css.sass.erb' => :sass_erb
|
106
|
+
}.merge(super)
|
82
107
|
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def engine_from_path(name, dir, options)
|
86
|
-
full_filename, syntax = Sass::Util.destructure(find_real_file(dir, name, options))
|
87
|
-
return unless full_filename && File.readable?(full_filename)
|
88
108
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
importer: self
|
93
|
-
))
|
109
|
+
def find_relative(*args)
|
110
|
+
deprecate_extra_css_extension(super)
|
111
|
+
end
|
94
112
|
|
95
|
-
|
96
|
-
|
113
|
+
def find(*args)
|
114
|
+
deprecate_extra_css_extension(super)
|
97
115
|
end
|
98
116
|
|
99
|
-
|
117
|
+
private
|
118
|
+
def deprecate_extra_css_extension(engine)
|
119
|
+
if engine && filename = engine.options[:filename]
|
120
|
+
if filename.end_with?('.css.scss')
|
121
|
+
msg = "Extra .css in SCSS file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss', '.scss')}."
|
122
|
+
elsif filename.end_with?('.css.sass')
|
123
|
+
msg = "Extra .css in SASS file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass', '.sass')}."
|
124
|
+
elsif filename.end_with?('.css.scss.erb')
|
125
|
+
msg = "Extra .css in SCSS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss.erb', '.scss.erb')}."
|
126
|
+
elsif filename.end_with?('.css.sass.erb')
|
127
|
+
msg = "Extra .css in SASS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass.erb', '.sass.erb')}."
|
128
|
+
end
|
129
|
+
|
130
|
+
ActiveSupport::Deprecation.warn(msg) if msg
|
131
|
+
end
|
132
|
+
|
133
|
+
engine
|
134
|
+
end
|
100
135
|
end
|
101
136
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
attributes.engines.reverse - [Sprockets::ScssTemplate, Sprockets::SassTemplate]
|
137
|
+
include Deprecated
|
138
|
+
include ERB
|
139
|
+
include Globbing
|
106
140
|
|
107
|
-
|
141
|
+
# Allow .css files to be @import'd
|
142
|
+
def extensions
|
143
|
+
{ 'css' => :scss }.merge(super)
|
108
144
|
end
|
145
|
+
end
|
109
146
|
end
|
110
147
|
end
|
data/lib/sass/rails/logger.rb
CHANGED
data/lib/sass/rails/railtie.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
+
require 'sass'
|
2
|
+
require 'active_support/core_ext/class/attribute'
|
1
3
|
require 'sprockets/railtie'
|
2
4
|
|
3
5
|
module Sass::Rails
|
4
6
|
class Railtie < ::Rails::Railtie
|
5
|
-
module SassContext
|
6
|
-
attr_accessor :sass_config
|
7
|
-
end
|
8
|
-
|
9
7
|
config.sass = ActiveSupport::OrderedOptions.new
|
10
8
|
|
11
9
|
# Establish static configuration defaults
|
@@ -23,11 +21,15 @@ module Sass::Rails
|
|
23
21
|
config.sass.logger = Sass::Rails::Logger.new
|
24
22
|
|
25
23
|
# Set the default stylesheet engine
|
26
|
-
# It can be
|
24
|
+
# It can be overridden by passing:
|
27
25
|
# --stylesheet_engine=sass
|
28
26
|
# to the rails generate command
|
29
27
|
config.app_generators.stylesheet_engine config.sass.preferred_syntax
|
30
28
|
|
29
|
+
if config.respond_to?(:annotations)
|
30
|
+
config.annotations.register_extensions("scss", "sass") { |annotation| /\/\/\s*(#{annotation}):?\s*(.*)$/ }
|
31
|
+
end
|
32
|
+
|
31
33
|
# Remove the sass middleware if it gets inadvertently enabled by applications.
|
32
34
|
config.after_initialize do |app|
|
33
35
|
app.config.middleware.delete(Sass::Plugin::Rack) if defined?(Sass::Plugin::Rack)
|
@@ -51,20 +53,41 @@ module Sass::Rails
|
|
51
53
|
config.sass.full_exception = app.config.consider_all_requests_local
|
52
54
|
end
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
config.assets.configure do |env|
|
57
|
+
if env.respond_to?(:register_engine)
|
58
|
+
args = ['.sass', Sass::Rails::SassTemplate]
|
59
|
+
args << { silence_deprecation: true } if env.method(:register_engine).arity.abs > 2
|
60
|
+
env.register_engine(*args)
|
61
|
+
|
62
|
+
args = ['.scss', Sass::Rails::ScssTemplate]
|
63
|
+
args << { silence_deprecation: true } if env.method(:register_engine).arity.abs > 2
|
64
|
+
env.register_engine(*args)
|
65
|
+
end
|
66
|
+
|
67
|
+
if env.respond_to?(:register_transformer)
|
68
|
+
env.register_transformer 'text/sass', 'text/css',
|
69
|
+
Sprockets::SassProcessor.new(importer: SassImporter, sass_config: app.config.sass)
|
70
|
+
env.register_transformer 'text/scss', 'text/css',
|
71
|
+
Sprockets::ScssProcessor.new(importer: SassImporter, sass_config: app.config.sass)
|
72
|
+
end
|
73
|
+
|
74
|
+
env.context_class.class_eval do
|
75
|
+
class_attribute :sass_config
|
76
|
+
self.sass_config = app.config.sass
|
77
|
+
end
|
57
78
|
end
|
58
79
|
|
59
80
|
Sass.logger = app.config.sass.logger
|
60
81
|
end
|
61
82
|
|
62
83
|
initializer :setup_compression, group: :all do |app|
|
63
|
-
|
64
|
-
app.config.assets.css_compressor ||= :sass
|
65
|
-
else
|
84
|
+
if Rails.env.development?
|
66
85
|
# Use expanded output instead of the sass default of :nested unless specified
|
67
86
|
app.config.sass.style ||= :expanded
|
87
|
+
else
|
88
|
+
# config.assets.css_compressor may be set to nil in non-dev environments.
|
89
|
+
# otherwise, the default is sass compression.
|
90
|
+
app.config.assets.css_compressor = :sass unless app.config.assets.has_key?(:css_compressor)
|
68
91
|
end
|
69
92
|
end
|
70
93
|
end
|
data/lib/sass/rails/template.rb
CHANGED
@@ -1,28 +1,72 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
require 'sass'
|
2
|
+
require 'sass/rails/cache_store'
|
3
|
+
require 'sass/rails/helpers'
|
4
|
+
require 'sprockets/sass_functions'
|
5
|
+
require 'tilt'
|
6
|
+
|
7
|
+
module Sass
|
8
|
+
module Rails
|
9
|
+
class SassTemplate < Tilt::Template
|
10
|
+
def self.default_mime_type
|
11
|
+
'text/css'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.engine_initialized?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize_engine
|
19
|
+
end
|
20
|
+
|
21
|
+
def prepare
|
22
|
+
end
|
23
|
+
|
24
|
+
def syntax
|
25
|
+
:sass
|
26
|
+
end
|
27
|
+
|
28
|
+
def evaluate(context, locals, &block)
|
29
|
+
cache_store = CacheStore.new(context.environment)
|
30
|
+
|
31
|
+
options = {
|
32
|
+
:filename => eval_file,
|
33
|
+
:line => line,
|
34
|
+
:syntax => syntax,
|
35
|
+
:cache_store => cache_store,
|
36
|
+
:importer => importer_class.new(context.pathname.to_s),
|
37
|
+
:load_paths => context.environment.paths.map { |path| importer_class.new(path.to_s) },
|
38
|
+
:sprockets => {
|
39
|
+
:context => context,
|
40
|
+
:environment => context.environment
|
41
|
+
}
|
18
42
|
}
|
19
|
-
}
|
20
43
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
44
|
+
sass_config = context.sass_config.merge(options)
|
45
|
+
|
46
|
+
engine = ::Sass::Engine.new(data, sass_config)
|
47
|
+
css = engine.render
|
48
|
+
|
49
|
+
engine.dependencies.map do |dependency|
|
50
|
+
context.depend_on(dependency.options[:filename])
|
51
|
+
end
|
52
|
+
|
53
|
+
css
|
54
|
+
rescue ::Sass::SyntaxError => e
|
55
|
+
context.__LINE__ = e.sass_backtrace.first[:line]
|
56
|
+
raise e
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def importer_class
|
62
|
+
SassImporter
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class ScssTemplate < SassTemplate
|
67
|
+
def syntax
|
68
|
+
:scss
|
69
|
+
end
|
26
70
|
end
|
27
71
|
end
|
28
72
|
end
|
data/lib/sass/rails/version.rb
CHANGED