sass-rails3 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/.travis.yml +22 -0
- data/CHANGELOG.md +40 -0
- data/Gemfile +8 -0
- data/MIT-LICENSE +21 -0
- data/README.md +98 -0
- data/Rakefile +29 -0
- data/lib/rails/generators/sass/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/sass/assets/templates/stylesheet.css.sass +3 -0
- data/lib/rails/generators/sass/scaffold/scaffold_generator.rb +9 -0
- data/lib/rails/generators/sass_scaffold.rb +16 -0
- data/lib/rails/generators/scss/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/scss/assets/templates/stylesheet.css.scss +3 -0
- data/lib/rails/generators/scss/scaffold/scaffold_generator.rb +10 -0
- data/lib/sass-rails3.rb +1 -0
- data/lib/sass/rails.rb +10 -0
- data/lib/sass/rails/helpers.rb +30 -0
- data/lib/sass/rails/importer.rb +91 -0
- data/lib/sass/rails/logger.rb +21 -0
- data/lib/sass/rails/railtie.rb +62 -0
- data/lib/sass/rails/version.rb +5 -0
- data/sass-rails3.gemspec +26 -0
- data/sass-rails3.gemspec.erb +26 -0
- data/test/fixtures/alternate_config_project/.gitignore +5 -0
- data/test/fixtures/alternate_config_project/Gemfile +7 -0
- data/test/fixtures/alternate_config_project/README +261 -0
- data/test/fixtures/alternate_config_project/Rakefile +7 -0
- 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 +9 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/_top_level_partial.css.scss +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/application.css.scss +32 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/css_application.css +7 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/globbed/globbed.css.scss +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/globbed/nested/nested_glob.css.scss +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_sass_import.css.sass +5 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_scss_import.css.scss +9 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_without_css_ext.scss +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/_relative_sass.css.sass +2 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/_relative_scss.css.scss +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/another_plain.css +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/plain.css +3 -0
- data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/second_level.css.scss +1 -0
- data/test/fixtures/alternate_config_project/app/controllers/application_controller.rb +3 -0
- data/test/fixtures/alternate_config_project/app/helpers/application_helper.rb +2 -0
- 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 +14 -0
- data/test/fixtures/alternate_config_project/config.ru +4 -0
- data/test/fixtures/alternate_config_project/config/application.rb +49 -0
- data/test/fixtures/alternate_config_project/config/boot.rb +6 -0
- data/test/fixtures/alternate_config_project/config/database.yml +25 -0
- data/test/fixtures/alternate_config_project/config/environment.rb +5 -0
- data/test/fixtures/alternate_config_project/config/environments/development.rb +27 -0
- data/test/fixtures/alternate_config_project/config/environments/production.rb +56 -0
- data/test/fixtures/alternate_config_project/config/environments/test.rb +38 -0
- data/test/fixtures/alternate_config_project/config/initializers/backtrace_silencers.rb +7 -0
- data/test/fixtures/alternate_config_project/config/initializers/inflections.rb +10 -0
- data/test/fixtures/alternate_config_project/config/initializers/mime_types.rb +5 -0
- data/test/fixtures/alternate_config_project/config/initializers/secret_token.rb +7 -0
- data/test/fixtures/alternate_config_project/config/initializers/session_store.rb +8 -0
- data/test/fixtures/alternate_config_project/config/initializers/wrap_parameters.rb +12 -0
- data/test/fixtures/alternate_config_project/config/locales/en.yml +5 -0
- data/test/fixtures/alternate_config_project/config/routes.rb +58 -0
- data/test/fixtures/alternate_config_project/db/seeds.rb +7 -0
- data/test/fixtures/alternate_config_project/doc/README_FOR_APP +2 -0
- 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 +26 -0
- data/test/fixtures/alternate_config_project/public/422.html +26 -0
- data/test/fixtures/alternate_config_project/public/500.html +26 -0
- data/test/fixtures/alternate_config_project/public/favicon.ico +0 -0
- data/test/fixtures/alternate_config_project/public/index.html +241 -0
- data/test/fixtures/alternate_config_project/public/robots.txt +5 -0
- data/test/fixtures/alternate_config_project/script/rails +6 -0
- 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 +8 -0
- data/test/fixtures/engine_project/Gemfile +14 -0
- data/test/fixtures/engine_project/MIT-LICENSE +20 -0
- data/test/fixtures/engine_project/README.rdoc +3 -0
- data/test/fixtures/engine_project/Rakefile +34 -0
- 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 +16 -0
- data/test/fixtures/engine_project/app/assets/stylesheets/engine_project/application.css +13 -0
- data/test/fixtures/engine_project/app/controllers/engine_project/application_controller.rb +4 -0
- data/test/fixtures/engine_project/app/helpers/engine_project/application_helper.rb +4 -0
- data/test/fixtures/engine_project/app/views/layouts/engine_project/application.html.erb +14 -0
- data/test/fixtures/engine_project/config/routes.rb +2 -0
- data/test/fixtures/engine_project/engine_project.gemspec +23 -0
- data/test/fixtures/engine_project/lib/engine_project.rb +4 -0
- data/test/fixtures/engine_project/lib/engine_project/engine.rb +5 -0
- data/test/fixtures/engine_project/lib/engine_project/version.rb +3 -0
- data/test/fixtures/engine_project/lib/tasks/engine_project_tasks.rake +4 -0
- data/test/fixtures/engine_project/script/rails +8 -0
- data/test/fixtures/engine_project/test/dummy/README.rdoc +28 -0
- data/test/fixtures/engine_project/test/dummy/Rakefile +6 -0
- data/test/fixtures/engine_project/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/fixtures/engine_project/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/fixtures/engine_project/test/dummy/app/controllers/application_controller.rb +5 -0
- 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 +2 -0
- 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 +14 -0
- data/test/fixtures/engine_project/test/dummy/bin/bundle +3 -0
- data/test/fixtures/engine_project/test/dummy/bin/rails +4 -0
- data/test/fixtures/engine_project/test/dummy/bin/rake +4 -0
- data/test/fixtures/engine_project/test/dummy/config.ru +4 -0
- data/test/fixtures/engine_project/test/dummy/config/application.rb +23 -0
- data/test/fixtures/engine_project/test/dummy/config/boot.rb +9 -0
- data/test/fixtures/engine_project/test/dummy/config/database.yml +25 -0
- data/test/fixtures/engine_project/test/dummy/config/environment.rb +5 -0
- data/test/fixtures/engine_project/test/dummy/config/environments/development.rb +27 -0
- data/test/fixtures/engine_project/test/dummy/config/environments/production.rb +80 -0
- data/test/fixtures/engine_project/test/dummy/config/environments/test.rb +36 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/fixtures/engine_project/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/fixtures/engine_project/test/dummy/config/locales/en.yml +23 -0
- data/test/fixtures/engine_project/test/dummy/config/routes.rb +4 -0
- 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 +27 -0
- data/test/fixtures/engine_project/test/dummy/public/422.html +26 -0
- data/test/fixtures/engine_project/test/dummy/public/500.html +26 -0
- data/test/fixtures/engine_project/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/sass_project/.gitignore +5 -0
- data/test/fixtures/sass_project/Gemfile +7 -0
- data/test/fixtures/sass_project/README +261 -0
- data/test/fixtures/sass_project/Rakefile +7 -0
- data/test/fixtures/sass_project/app/assets/images/rails.png +0 -0
- data/test/fixtures/sass_project/app/assets/javascripts/application.js +9 -0
- data/test/fixtures/sass_project/app/assets/stylesheets/application.css +7 -0
- data/test/fixtures/sass_project/app/controllers/application_controller.rb +3 -0
- data/test/fixtures/sass_project/app/helpers/application_helper.rb +2 -0
- 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 +14 -0
- data/test/fixtures/sass_project/config.ru +4 -0
- data/test/fixtures/sass_project/config/application.rb +52 -0
- data/test/fixtures/sass_project/config/boot.rb +6 -0
- data/test/fixtures/sass_project/config/database.yml +25 -0
- data/test/fixtures/sass_project/config/environment.rb +5 -0
- data/test/fixtures/sass_project/config/environments/development.rb +21 -0
- data/test/fixtures/sass_project/config/environments/production.rb +51 -0
- data/test/fixtures/sass_project/config/environments/test.rb +36 -0
- data/test/fixtures/sass_project/config/initializers/backtrace_silencers.rb +7 -0
- data/test/fixtures/sass_project/config/initializers/inflections.rb +10 -0
- data/test/fixtures/sass_project/config/initializers/mime_types.rb +5 -0
- data/test/fixtures/sass_project/config/initializers/secret_token.rb +7 -0
- data/test/fixtures/sass_project/config/initializers/session_store.rb +8 -0
- data/test/fixtures/sass_project/config/initializers/wrap_parameters.rb +12 -0
- data/test/fixtures/sass_project/config/locales/en.yml +5 -0
- data/test/fixtures/sass_project/config/routes.rb +58 -0
- data/test/fixtures/sass_project/db/seeds.rb +7 -0
- data/test/fixtures/sass_project/doc/README_FOR_APP +2 -0
- 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 +26 -0
- data/test/fixtures/sass_project/public/422.html +26 -0
- data/test/fixtures/sass_project/public/500.html +26 -0
- data/test/fixtures/sass_project/public/favicon.ico +0 -0
- data/test/fixtures/sass_project/public/index.html +241 -0
- data/test/fixtures/sass_project/public/robots.txt +5 -0
- data/test/fixtures/sass_project/script/rails +6 -0
- 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 +5 -0
- data/test/fixtures/scss_project/Gemfile +7 -0
- data/test/fixtures/scss_project/README +261 -0
- data/test/fixtures/scss_project/Rakefile +7 -0
- 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 +9 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/_top_level_partial.css.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/application.css.scss +37 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/css_application.css +7 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/css_erb_handler.css.erb +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/css_sass_erb_handler.css.sass.erb +2 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/css_scss_erb_handler.css.scss.erb +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/globbed/globbed.css.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/globbed/nested/nested_glob.css.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/_sass_import.css.sass +5 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/_scss_import.css.scss +9 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/_without_css_ext.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/_relative_sass.css.sass +2 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/_relative_scss.css.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/sass_erb_handler.sass.erb +2 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/scss_erb_handler.scss.erb +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/_defaults.css.scss +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/another_plain.css +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/plain.css +3 -0
- data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/second_level.css.scss +2 -0
- data/test/fixtures/scss_project/app/controllers/application_controller.rb +3 -0
- data/test/fixtures/scss_project/app/helpers/application_helper.rb +2 -0
- 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 +14 -0
- data/test/fixtures/scss_project/config.ru +4 -0
- data/test/fixtures/scss_project/config/application.rb +49 -0
- data/test/fixtures/scss_project/config/boot.rb +6 -0
- data/test/fixtures/scss_project/config/database.yml +25 -0
- data/test/fixtures/scss_project/config/environment.rb +5 -0
- data/test/fixtures/scss_project/config/environments/development.rb +23 -0
- data/test/fixtures/scss_project/config/environments/production.rb +53 -0
- data/test/fixtures/scss_project/config/environments/test.rb +38 -0
- data/test/fixtures/scss_project/config/initializers/backtrace_silencers.rb +7 -0
- data/test/fixtures/scss_project/config/initializers/inflections.rb +10 -0
- data/test/fixtures/scss_project/config/initializers/mime_types.rb +5 -0
- data/test/fixtures/scss_project/config/initializers/postprocessor.rb +3 -0
- data/test/fixtures/scss_project/config/initializers/secret_token.rb +7 -0
- data/test/fixtures/scss_project/config/initializers/session_store.rb +8 -0
- data/test/fixtures/scss_project/config/initializers/wrap_parameters.rb +12 -0
- data/test/fixtures/scss_project/config/locales/en.yml +5 -0
- data/test/fixtures/scss_project/config/routes.rb +58 -0
- data/test/fixtures/scss_project/db/seeds.rb +7 -0
- data/test/fixtures/scss_project/doc/README_FOR_APP +2 -0
- 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 +26 -0
- data/test/fixtures/scss_project/public/422.html +26 -0
- data/test/fixtures/scss_project/public/500.html +26 -0
- data/test/fixtures/scss_project/public/favicon.ico +0 -0
- data/test/fixtures/scss_project/public/index.html +241 -0
- data/test/fixtures/scss_project/public/robots.txt +5 -0
- data/test/fixtures/scss_project/script/rails +6 -0
- data/test/fixtures/scss_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/fixtures/scss_project/vendor/plugins/.gitkeep +0 -0
- data/test/sass_rails_generators_test.rb +62 -0
- data/test/sass_rails_logger_test.rb +24 -0
- data/test/sass_rails_test.rb +116 -0
- data/test/support/sass_rails_test_case.rb +162 -0
- data/test/test_helper.rb +25 -0
- metadata +581 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
rvm:
|
|
3
|
+
- 1.9.3
|
|
4
|
+
- 2.0.0
|
|
5
|
+
- 2.1.0
|
|
6
|
+
gemfile:
|
|
7
|
+
- test/gemfiles/Gemfile-master
|
|
8
|
+
- Gemfile
|
|
9
|
+
before_install: gem install bundler
|
|
10
|
+
script: bundle exec rake test
|
|
11
|
+
notifications:
|
|
12
|
+
email: false
|
|
13
|
+
irc:
|
|
14
|
+
on_success: change
|
|
15
|
+
on_failure: always
|
|
16
|
+
channels:
|
|
17
|
+
- "irc.freenode.org#rails-contrib"
|
|
18
|
+
campfire:
|
|
19
|
+
on_success: change
|
|
20
|
+
on_failure: always
|
|
21
|
+
rooms:
|
|
22
|
+
- secure: "CGWvthGkBKNnTnk9YSmf9AXKoiRI33fCl5D3jU4nx3cOPu6kv2R9nMjt9EAo\nOuS4Q85qNSf4VNQ2cUPNiNYSWQ+XiTfivKvDUw/QW9r1FejYyeWarMsSBWA+\n0fADjF1M2dkDIVLgYPfwoXEv7l+j654F1KLKB69F0F/netwP9CQ="
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 4.0.1 (Oct 15, 2013)
|
|
4
|
+
|
|
5
|
+
* Remove Post Processors from asset evaluation.
|
|
6
|
+
|
|
7
|
+
## 4.0.0 (Jun 25, 2013)
|
|
8
|
+
|
|
9
|
+
* Add support for importing ERB files.
|
|
10
|
+
* Remove `Sass::Rails::Compressor`. Use `Sprockets::SassCompressor` (`:sass` option) instead.
|
|
11
|
+
* Remove `tilt` dependency.
|
|
12
|
+
* Bump `sprockets-rails` to `2.0.0.rc4`.
|
|
13
|
+
|
|
14
|
+
## 4.0.0.rc1 (Apr 18, 2013)
|
|
15
|
+
|
|
16
|
+
* No changes.
|
|
17
|
+
|
|
18
|
+
## 4.0.0.beta1 (Feb 25, 2013)
|
|
19
|
+
|
|
20
|
+
* Remove `compress` option from `config.assets`. Instead, turn on
|
|
21
|
+
compression for all environments except development.
|
|
22
|
+
* Deprecate `asset_path` and `asset_url` with two arguments.
|
|
23
|
+
* Add Rails 4 support.
|
|
24
|
+
* Drop Ruby 1.8 support.
|
|
25
|
+
|
|
26
|
+
## 3.1.5.rc.1 (Oct 16, 2011)
|
|
27
|
+
|
|
28
|
+
* Several bug fixes.
|
|
29
|
+
* Performance and bug fixes when compressing stylesheets.
|
|
30
|
+
* Update dependency to latest sass stable release to fix caching issues.
|
|
31
|
+
|
|
32
|
+
## 3.1.2 (Sept 15, 2011)
|
|
33
|
+
|
|
34
|
+
* Add `asset-data-url` helper for base-64 encoding of assets within stylesheets.
|
|
35
|
+
* Add explicit dependency on sprockets.
|
|
36
|
+
|
|
37
|
+
## 3.1.1 (Sept 13, 2011)
|
|
38
|
+
|
|
39
|
+
* Add explicit version dependency on tilt.
|
|
40
|
+
* Add MIT License.
|
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2011 Christopher Eppstein
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Official Ruby-on-Rails Integration with Sass
|
|
2
|
+
|
|
3
|
+
This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language.
|
|
4
|
+
|
|
5
|
+
## Installing
|
|
6
|
+
|
|
7
|
+
Since Rails 3.1, new Rails projects will be already configured to use Sass. If you are upgrading to Rails 3.1 you will need to add the following to your Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'sass-rails3'
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
To configure Sass via Rails set use `config.sass` in your
|
|
14
|
+
application and/or environment files to set configuration
|
|
15
|
+
properties that will be passed to Sass.
|
|
16
|
+
|
|
17
|
+
### Options
|
|
18
|
+
|
|
19
|
+
The [list of supported options](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#options)
|
|
20
|
+
can be found on the Sass Website with the following caveats:
|
|
21
|
+
|
|
22
|
+
1. `:style` - This option is not supported. This is determined by the Rails environment. It's `:expanded` only on development, otherwise it's `:compressed`.
|
|
23
|
+
2. `:never_update` - This option is not supported. Instead set `config.assets.enabled = false`
|
|
24
|
+
3. `: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.
|
|
25
|
+
4. `:always_check` - This option is not supported. Sprockets always checks in development.
|
|
26
|
+
5. `:syntax` - This is determined by the file's extensions.
|
|
27
|
+
6. `:filename` - This is determined by the file's name.
|
|
28
|
+
7. `:line` - This is provided by the template handler.
|
|
29
|
+
|
|
30
|
+
### Example
|
|
31
|
+
|
|
32
|
+
MyProject::Application.configure do
|
|
33
|
+
config.sass.line_comments = false
|
|
34
|
+
config.sass.cache = false
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
## Important Note
|
|
38
|
+
|
|
39
|
+
Sprockets provides some directives that are placed inside of comments called `require`, `require_tree`, and
|
|
40
|
+
`require_self`. **<span style="color:#c00">DO NOT USE THEM IN YOUR SASS/SCSS FILES.</span>** They are very
|
|
41
|
+
primitive and do not work well with Sass files. Instead, use Sass's native `@import` directive which
|
|
42
|
+
`sass-rails3` has customized to integrate with the conventions of your Rails projects.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
### Glob Imports
|
|
47
|
+
|
|
48
|
+
When in Rails, there is a special import syntax that allows you to
|
|
49
|
+
glob imports relative to the folder of the stylesheet that is doing the importing.
|
|
50
|
+
|
|
51
|
+
* `@import "mixins/*"` will import all the files in the mixins folder
|
|
52
|
+
* `@import "mixins/**/*"` will import all the files in the mixins tree
|
|
53
|
+
|
|
54
|
+
Any valid ruby glob may be used. The imports are sorted alphabetically.
|
|
55
|
+
|
|
56
|
+
**NOTE:** It is recommended that you only use this when importing pure library
|
|
57
|
+
files (containing mixins and variables) because it is difficult to control the
|
|
58
|
+
cascade ordering for imports that contain styles using this approach.
|
|
59
|
+
|
|
60
|
+
### Asset Helpers
|
|
61
|
+
When using the asset pipeline, paths to assets must be rewritten.
|
|
62
|
+
When referencing assets use the following asset helpers (underscored in Ruby, hyphenated
|
|
63
|
+
in Sass):
|
|
64
|
+
|
|
65
|
+
#### `asset-path($relative-asset-path)`
|
|
66
|
+
Returns a string to the asset.
|
|
67
|
+
|
|
68
|
+
* `asset-path("rails.png")` becomes `"/assets/rails.png"`
|
|
69
|
+
|
|
70
|
+
#### `asset-url($relative-asset-path)`
|
|
71
|
+
Returns a url reference to the asset.
|
|
72
|
+
|
|
73
|
+
* `asset-url("rails.png")` becomes `url(/assets/rails.png)`
|
|
74
|
+
|
|
75
|
+
As a convenience, for each of the following asset classes there are
|
|
76
|
+
corresponding `-path` and `-url` helpers:
|
|
77
|
+
image, font, video, audio, javascript, stylesheet.
|
|
78
|
+
|
|
79
|
+
* `image-path("rails.png")` becomes `"/assets/rails.png"`
|
|
80
|
+
* `image-url("rails.png")` becomes `url(/assets/rails.png)`
|
|
81
|
+
|
|
82
|
+
#### `asset-data-url($relative-asset-path)`
|
|
83
|
+
Returns a url reference to the Base64-encoded asset at the specified path.
|
|
84
|
+
|
|
85
|
+
* `asset-data-url("rails.png")` becomes `url(data:image/png;base64,iVBORw0K...)`
|
|
86
|
+
|
|
87
|
+
## Running Tests
|
|
88
|
+
|
|
89
|
+
$ bundle install
|
|
90
|
+
$ bundle exec rake test
|
|
91
|
+
|
|
92
|
+
If you need to test against local gems, use Bundler's gem :path option in the Gemfile and also edit `test/support/test_helper.rb` and tell the tests where the gem is checked out.
|
|
93
|
+
|
|
94
|
+
## Code Status
|
|
95
|
+
|
|
96
|
+
* [](http://travis-ci.org/rails/sass-rails3)
|
|
97
|
+
* [](http://badge.fury.io/rb/sass-rails3)
|
|
98
|
+
* [](https://gemnasium.com/rails/sass-rails3)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'bundler'
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
3
|
+
|
|
4
|
+
require 'rake/testtask'
|
|
5
|
+
|
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
|
7
|
+
t.libs << 'lib'
|
|
8
|
+
t.libs << 'test'
|
|
9
|
+
t.pattern = 'test/**/*_test.rb'
|
|
10
|
+
t.verbose = false
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
desc 'Default: run unit tests.'
|
|
14
|
+
task default: :test
|
|
15
|
+
|
|
16
|
+
specname = "sass-rails3.gemspec"
|
|
17
|
+
deps = `git ls-files`.split("\n") - [specname]
|
|
18
|
+
|
|
19
|
+
file specname => deps do
|
|
20
|
+
files = `git ls-files`.split("\n")
|
|
21
|
+
test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
22
|
+
executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
23
|
+
|
|
24
|
+
require 'erb'
|
|
25
|
+
|
|
26
|
+
File.open specname, 'w:utf-8' do |f|
|
|
27
|
+
f.write ERB.new(File.read("#{specname}.erb")).result(binding)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "rails/generators/named_base"
|
|
2
|
+
|
|
3
|
+
module Sass
|
|
4
|
+
module Generators
|
|
5
|
+
class AssetsGenerator < ::Rails::Generators::NamedBase
|
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
7
|
+
|
|
8
|
+
def copy_sass
|
|
9
|
+
template "stylesheet.css.sass", File.join('app/assets/stylesheets', class_path, "#{file_name}.css.sass")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "sass/css"
|
|
2
|
+
require "rails/generators/named_base"
|
|
3
|
+
|
|
4
|
+
module Sass
|
|
5
|
+
module Generators
|
|
6
|
+
class ScaffoldBase < ::Rails::Generators::NamedBase
|
|
7
|
+
def copy_stylesheet
|
|
8
|
+
dir = ::Rails::Generators::ScaffoldGenerator.source_root
|
|
9
|
+
file = File.join(dir, "scaffold.css")
|
|
10
|
+
converted_contents = ::Sass::CSS.new(File.read(file)).render(syntax)
|
|
11
|
+
create_file "app/assets/stylesheets/scaffolds.css.#{syntax}", converted_contents
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "rails/generators/named_base"
|
|
2
|
+
|
|
3
|
+
module Scss
|
|
4
|
+
module Generators
|
|
5
|
+
class AssetsGenerator < ::Rails::Generators::NamedBase
|
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
7
|
+
|
|
8
|
+
def copy_scss
|
|
9
|
+
template "stylesheet.css.scss", File.join('app/assets/stylesheets', class_path, "#{file_name}.css.scss")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/sass-rails3.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'sass/rails'
|
data/lib/sass/rails.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'sprockets/sass_functions'
|
|
2
|
+
require 'active_support/deprecation'
|
|
3
|
+
|
|
4
|
+
module Sprockets
|
|
5
|
+
module SassFunctions
|
|
6
|
+
if instance_methods.map(&:to_sym).include?(:asset_path)
|
|
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
|
+
|
|
26
|
+
def asset_data_url(path)
|
|
27
|
+
Sass::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require 'sprockets/sass_importer'
|
|
2
|
+
|
|
3
|
+
module Sprockets
|
|
4
|
+
class SassImporter < Sass::Importers::Filesystem
|
|
5
|
+
GLOB = /\*|\[.+\]/
|
|
6
|
+
|
|
7
|
+
attr_reader :context
|
|
8
|
+
private :context
|
|
9
|
+
|
|
10
|
+
def extensions
|
|
11
|
+
{
|
|
12
|
+
'css' => :scss,
|
|
13
|
+
'css.scss' => :scss,
|
|
14
|
+
'css.sass' => :sass,
|
|
15
|
+
'css.erb' => :scss,
|
|
16
|
+
'scss.erb' => :scss,
|
|
17
|
+
'sass.erb' => :sass,
|
|
18
|
+
'css.scss.erb' => :scss,
|
|
19
|
+
'css.sass.erb' => :sass
|
|
20
|
+
}.merge!(super)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def find_relative(name, base, options)
|
|
24
|
+
if name =~ GLOB
|
|
25
|
+
glob_imports(name, Pathname.new(base), options)
|
|
26
|
+
else
|
|
27
|
+
engine_from_path(name, File.dirname(base), options)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def find(name, options)
|
|
32
|
+
if name =~ GLOB
|
|
33
|
+
nil # globs must be relative
|
|
34
|
+
else
|
|
35
|
+
engine_from_path(name, root, options)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def each_globbed_file(glob, base_pathname, options)
|
|
40
|
+
Dir["#{base_pathname}/#{glob}"].sort.each do |filename|
|
|
41
|
+
next if filename == options[:filename]
|
|
42
|
+
yield filename if File.directory?(filename) || context.asset_requirable?(filename)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def glob_imports(glob, base_pathname, options)
|
|
47
|
+
contents = ""
|
|
48
|
+
each_globbed_file(glob, base_pathname.dirname, options) do |filename|
|
|
49
|
+
if File.directory?(filename)
|
|
50
|
+
context.depend_on(filename)
|
|
51
|
+
elsif context.asset_requirable?(filename)
|
|
52
|
+
context.depend_on(filename)
|
|
53
|
+
contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
return nil if contents.empty?
|
|
57
|
+
Sass::Engine.new(contents, options.merge(
|
|
58
|
+
:filename => base_pathname.to_s,
|
|
59
|
+
:importer => self,
|
|
60
|
+
:syntax => :scss
|
|
61
|
+
))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
def engine_from_path(name, dir, options)
|
|
67
|
+
full_filename, syntax = Sass::Util.destructure(find_real_file(dir, name, options))
|
|
68
|
+
return unless full_filename && File.readable?(full_filename)
|
|
69
|
+
|
|
70
|
+
engine = Sass::Engine.new(evaluate(full_filename), options.merge(
|
|
71
|
+
syntax: syntax,
|
|
72
|
+
filename: full_filename,
|
|
73
|
+
importer: self
|
|
74
|
+
))
|
|
75
|
+
|
|
76
|
+
if engine && (filename = engine.options[:filename])
|
|
77
|
+
@context.depend_on(filename)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
engine
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def evaluate(filename)
|
|
84
|
+
attributes = context.environment.attributes_for(filename)
|
|
85
|
+
processors = context.environment.preprocessors(attributes.content_type) +
|
|
86
|
+
attributes.engines.reverse - [Sprockets::ScssTemplate, Sprockets::SassTemplate]
|
|
87
|
+
|
|
88
|
+
context.evaluate(filename, processors: processors)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|