sass-rails 5.0.0.beta1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/lib/rails/generators/sass/assets/assets_generator.rb +1 -1
- data/lib/rails/generators/sass/assets/templates/{stylesheet.css.sass → stylesheet.sass} +0 -0
- data/lib/rails/generators/sass_scaffold.rb +1 -2
- data/lib/rails/generators/scss/assets/assets_generator.rb +1 -1
- data/lib/rails/generators/scss/assets/templates/{stylesheet.css.scss → stylesheet.scss} +0 -0
- data/lib/sass/rails/cache_store.rb +31 -0
- data/lib/sass/rails/helpers.rb +2 -21
- data/lib/sass/rails/importer.rb +119 -69
- data/lib/sass/rails/railtie.rb +5 -6
- data/lib/sass/rails/template.rb +41 -11
- data/lib/sass/rails/version.rb +1 -1
- metadata +71 -471
- data/.gitignore +0 -6
- data/.travis.yml +0 -24
- data/Gemfile +0 -8
- data/Rakefile +0 -29
- data/sass-rails.gemspec +0 -27
- data/sass-rails.gemspec.erb +0 -27
- 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.ru +0 -4
- 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/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.rb +0 -4
- 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/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.ru +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/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.ru +0 -4
- 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 -24
- data/test/fixtures/sass_project/config/environments/production.rb +0 -54
- data/test/fixtures/sass_project/config/environments/test.rb +0 -39
- 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/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.ru +0 -4
- 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/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-4-0-stable +0 -9
- data/test/gemfiles/Gemfile-4-1-stable +0 -9
- data/test/gemfiles/Gemfile-master +0 -9
- data/test/sass_rails_generators_test.rb +0 -62
- data/test/sass_rails_logger_test.rb +0 -27
- data/test/sass_rails_test.rb +0 -157
- data/test/support/sass_rails_test_case.rb +0 -181
- data/test/test_helper.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e8d1de04c3b2051b0aab8f75e4aab8fb1bbd150
|
4
|
+
data.tar.gz: 510bf6be01cd389f355589ef1e323e47b18cea7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d78a7e4a55fd6d9ca44a612051ed5d260b379f92ac763b421f053f525a468e31644d468d759fba9015db5d4641276ed63a86b0ea732cf0f072e4cbacf6a67e0
|
7
|
+
data.tar.gz: 86b70308e42217a83c48f0ba8899bfcd2a135a02ddd78517f1a99e8206ea8def3c87deb0814fe9612dc58669a39cc4c1c38f229c7bbdae20c4c5b0d13ea9f57a
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
##
|
3
|
+
## 5.0.0 (Dec 12, 2014)
|
4
4
|
|
5
5
|
* Register scss and sass extensions for rake notes
|
6
|
+
* Make possible to use sprockes > 2.8 and < 4
|
7
|
+
* Make possible to use sass ~> 3.1
|
8
|
+
* Deprecate .css.scss and .css.sass extentions
|
9
|
+
|
10
|
+
## 4.0.5 (Nov 25, 2014)
|
11
|
+
|
12
|
+
* Make possible to use sprockets 2.12.
|
13
|
+
|
14
|
+
## 4.0.4 (Oct 29, 2014)
|
15
|
+
|
16
|
+
* Make possible to use any sprockets version in the 2.11 series.
|
17
|
+
* Require at least sass 3.2.2.
|
6
18
|
|
7
19
|
## 4.0.3 (Apr 4, 2014)
|
8
20
|
|
@@ -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
|
File without changes
|
@@ -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
|
File without changes
|
@@ -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,11 @@
|
|
1
1
|
require 'sprockets/sass_functions'
|
2
|
-
require 'active_support/deprecation'
|
3
2
|
|
4
3
|
module Sprockets
|
5
4
|
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
5
|
def asset_data_url(path)
|
27
6
|
Sass::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
|
28
7
|
end
|
29
8
|
end
|
30
9
|
end
|
10
|
+
|
11
|
+
::Sass::Script::Functions.send :include, Sprockets::SassFunctions
|
data/lib/sass/rails/importer.rb
CHANGED
@@ -1,96 +1,146 @@
|
|
1
|
+
require 'active_support/deprecation/reporting'
|
2
|
+
require 'sass'
|
1
3
|
require 'sprockets/sass_importer'
|
4
|
+
require 'tilt'
|
2
5
|
|
3
6
|
module Sass
|
4
7
|
module Rails
|
5
8
|
class SassImporter < Sass::Importers::Filesystem
|
6
|
-
|
9
|
+
module Globbing
|
10
|
+
GLOB = /(\A|\/)(\*|\*\*\/\*)\z/
|
7
11
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
'css' => :scss,
|
17
|
-
'css.scss' => :scss,
|
18
|
-
'css.sass' => :sass,
|
19
|
-
'css.erb' => :scss,
|
20
|
-
'scss.erb' => :scss,
|
21
|
-
'sass.erb' => :sass,
|
22
|
-
'css.scss.erb' => :scss,
|
23
|
-
'css.sass.erb' => :sass
|
24
|
-
}.merge!(super)
|
25
|
-
end
|
26
|
-
|
27
|
-
def find_relative(name, base, options)
|
28
|
-
if name =~ GLOB
|
29
|
-
glob_imports(name, Pathname.new(base), options)
|
30
|
-
else
|
31
|
-
engine_from_path(name, File.dirname(base), options)
|
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
|
32
20
|
end
|
33
|
-
end
|
34
21
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
engine_from_path(name, root, options)
|
22
|
+
def find(name, options)
|
23
|
+
# globs must be relative
|
24
|
+
return if name =~ GLOB
|
25
|
+
super
|
40
26
|
end
|
41
|
-
end
|
42
27
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
context.depend_on(File.expand_path('..', filename))
|
51
|
-
elsif context.asset_requirable?(filename)
|
52
|
-
context.depend_on(File.dirname(filename))
|
53
|
-
yield filename
|
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"
|
54
35
|
end
|
36
|
+
return nil if contents == ""
|
37
|
+
Sass::Engine.new(contents, options.merge(
|
38
|
+
:importer => self,
|
39
|
+
:syntax => :scss
|
40
|
+
))
|
55
41
|
end
|
56
|
-
end
|
57
42
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
43
|
+
def each_globbed_file(base, glob, context)
|
44
|
+
raise ArgumentError unless glob == "*" || glob == "**/*"
|
45
|
+
|
46
|
+
exts = extensions.keys.map { |ext| Regexp.escape(".#{ext}") }.join("|")
|
47
|
+
sass_re = Regexp.compile("(#{exts})$")
|
48
|
+
|
49
|
+
context.depend_on(base)
|
50
|
+
|
51
|
+
Dir["#{base}/#{glob}"].sort.each do |path|
|
52
|
+
if File.directory?(path)
|
53
|
+
context.depend_on(path)
|
54
|
+
elsif sass_re =~ path
|
55
|
+
yield path
|
56
|
+
end
|
57
|
+
end
|
62
58
|
end
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
59
|
+
end
|
60
|
+
|
61
|
+
module ERB
|
62
|
+
def extensions
|
63
|
+
{
|
64
|
+
'css.erb' => :scss_erb,
|
65
|
+
'scss.erb' => :scss_erb,
|
66
|
+
'sass.erb' => :sass_erb
|
67
|
+
}.merge(super)
|
69
68
|
end
|
70
69
|
|
70
|
+
def erb_extensions
|
71
|
+
{
|
72
|
+
:scss_erb => :scss,
|
73
|
+
:sass_erb => :sass
|
74
|
+
}
|
75
|
+
end
|
71
76
|
|
72
|
-
def
|
73
|
-
|
74
|
-
|
77
|
+
def find_relative(*args)
|
78
|
+
process_erb_engine(super)
|
79
|
+
end
|
75
80
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
)
|
81
|
+
def find(*args)
|
82
|
+
process_erb_engine(super)
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
def process_erb_engine(engine)
|
87
|
+
if engine && engine.options[:sprockets] && syntax = erb_extensions[engine.options[:syntax]]
|
88
|
+
template = Tilt::ERBTemplate.new(engine.options[:filename])
|
89
|
+
contents = template.render(engine.options[:sprockets][:context], {})
|
90
|
+
|
91
|
+
Sass::Engine.new(contents, engine.options.merge(:syntax => syntax))
|
92
|
+
else
|
93
|
+
engine
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
82
97
|
|
83
|
-
|
98
|
+
module Deprecated
|
99
|
+
def extensions
|
100
|
+
{
|
101
|
+
'css.scss' => :scss,
|
102
|
+
'css.sass' => :sass,
|
103
|
+
'css.scss.erb' => :scss_erb,
|
104
|
+
'css.sass.erb' => :sass_erb
|
105
|
+
}.merge(super)
|
84
106
|
end
|
85
107
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
attributes.engines.reverse - [Sass::Rails::ScssTemplate, Sass::Rails::SassTemplate]
|
108
|
+
def find_relative(*args)
|
109
|
+
deprecate_extra_css_extension(super)
|
110
|
+
end
|
90
111
|
|
91
|
-
|
112
|
+
def find(*args)
|
113
|
+
deprecate_extra_css_extension(super)
|
92
114
|
end
|
93
115
|
|
116
|
+
private
|
117
|
+
def deprecate_extra_css_extension(engine)
|
118
|
+
if engine && filename = engine.options[:filename]
|
119
|
+
if filename.end_with?('.css.scss')
|
120
|
+
msg = "Extra .css in SCSS file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss', '.scss')}."
|
121
|
+
elsif filename.end_with?('.css.sass')
|
122
|
+
msg = "Extra .css in SASS file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass', '.sass')}."
|
123
|
+
elsif filename.end_with?('.css.scss.erb')
|
124
|
+
msg = "Extra .css in SCSS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss.erb', '.scss.erb')}."
|
125
|
+
elsif filename.end_with?('.css.sass.erb')
|
126
|
+
msg = "Extra .css in SASS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass.erb', '.sass.erb')}."
|
127
|
+
end
|
128
|
+
|
129
|
+
ActiveSupport::Deprecation.warn(msg) if msg
|
130
|
+
end
|
131
|
+
|
132
|
+
engine
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
include Deprecated
|
137
|
+
include ERB
|
138
|
+
include Globbing
|
139
|
+
|
140
|
+
# Allow .css files to be @import'd
|
141
|
+
def extensions
|
142
|
+
{ 'css' => :scss }.merge(super)
|
143
|
+
end
|
94
144
|
end
|
95
145
|
end
|
96
146
|
end
|
data/lib/sass/rails/railtie.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
+
require 'active_support/core_ext/class/attribute'
|
1
2
|
require 'sprockets/railtie'
|
2
3
|
|
3
4
|
module Sass::Rails
|
4
5
|
class Railtie < ::Rails::Railtie
|
5
|
-
module SassContext
|
6
|
-
attr_accessor :sass_config
|
7
|
-
end
|
8
|
-
|
9
6
|
config.sass = ActiveSupport::OrderedOptions.new
|
10
7
|
|
11
8
|
# Establish static configuration defaults
|
@@ -59,8 +56,10 @@ module Sass::Rails
|
|
59
56
|
app.assets.register_engine '.sass', Sass::Rails::SassTemplate
|
60
57
|
app.assets.register_engine '.scss', Sass::Rails::ScssTemplate
|
61
58
|
|
62
|
-
app.assets.context_class.
|
63
|
-
|
59
|
+
app.assets.context_class.class_eval do
|
60
|
+
class_attribute :sass_config
|
61
|
+
self.sass_config = app.config.sass
|
62
|
+
end
|
64
63
|
end
|
65
64
|
|
66
65
|
Sass.logger = app.config.sass.logger
|
data/lib/sass/rails/template.rb
CHANGED
@@ -1,39 +1,69 @@
|
|
1
|
-
require
|
1
|
+
require 'sass'
|
2
|
+
require 'sass/rails/cache_store'
|
3
|
+
require 'sass/rails/helpers'
|
4
|
+
require 'sprockets/sass_functions'
|
5
|
+
require 'tilt'
|
2
6
|
|
3
7
|
module Sass
|
4
8
|
module Rails
|
5
|
-
class SassTemplate <
|
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
|
6
27
|
|
7
28
|
def evaluate(context, locals, &block)
|
8
|
-
cache_store =
|
29
|
+
cache_store = CacheStore.new(context.environment)
|
9
30
|
|
10
31
|
options = {
|
11
32
|
:filename => eval_file,
|
12
33
|
:line => line,
|
13
34
|
:syntax => syntax,
|
14
35
|
:cache_store => cache_store,
|
15
|
-
:importer =>
|
16
|
-
:load_paths => context.environment.paths.map { |path|
|
36
|
+
:importer => importer_class.new(context.pathname.to_s),
|
37
|
+
:load_paths => context.environment.paths.map { |path| importer_class.new(path.to_s) },
|
17
38
|
:sprockets => {
|
18
39
|
:context => context,
|
19
40
|
:environment => context.environment
|
20
41
|
}
|
21
42
|
}
|
22
43
|
|
23
|
-
sass_config = context.
|
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
|
24
52
|
|
25
|
-
|
53
|
+
css
|
26
54
|
rescue ::Sass::SyntaxError => e
|
27
55
|
context.__LINE__ = e.sass_backtrace.first[:line]
|
28
56
|
raise e
|
29
57
|
end
|
30
|
-
end
|
31
58
|
|
32
|
-
|
33
|
-
|
34
|
-
|
59
|
+
private
|
60
|
+
|
61
|
+
def importer_class
|
62
|
+
SassImporter
|
35
63
|
end
|
64
|
+
end
|
36
65
|
|
66
|
+
class ScssTemplate < SassTemplate
|
37
67
|
def syntax
|
38
68
|
:scss
|
39
69
|
end
|