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.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -1
  3. data/lib/rails/generators/sass/assets/assets_generator.rb +1 -1
  4. data/lib/rails/generators/sass/assets/templates/{stylesheet.css.sass → stylesheet.sass} +0 -0
  5. data/lib/rails/generators/sass_scaffold.rb +1 -2
  6. data/lib/rails/generators/scss/assets/assets_generator.rb +1 -1
  7. data/lib/rails/generators/scss/assets/templates/{stylesheet.css.scss → stylesheet.scss} +0 -0
  8. data/lib/sass/rails/cache_store.rb +31 -0
  9. data/lib/sass/rails/helpers.rb +2 -21
  10. data/lib/sass/rails/importer.rb +119 -69
  11. data/lib/sass/rails/railtie.rb +5 -6
  12. data/lib/sass/rails/template.rb +41 -11
  13. data/lib/sass/rails/version.rb +1 -1
  14. metadata +71 -471
  15. data/.gitignore +0 -6
  16. data/.travis.yml +0 -24
  17. data/Gemfile +0 -8
  18. data/Rakefile +0 -29
  19. data/sass-rails.gemspec +0 -27
  20. data/sass-rails.gemspec.erb +0 -27
  21. data/test/fixtures/alternate_config_project/.gitignore +0 -5
  22. data/test/fixtures/alternate_config_project/Gemfile +0 -7
  23. data/test/fixtures/alternate_config_project/README +0 -261
  24. data/test/fixtures/alternate_config_project/Rakefile +0 -7
  25. data/test/fixtures/alternate_config_project/app/assets/images/1x1.png +0 -0
  26. data/test/fixtures/alternate_config_project/app/assets/images/rails.png +0 -0
  27. data/test/fixtures/alternate_config_project/app/assets/javascripts/application.js +0 -9
  28. data/test/fixtures/alternate_config_project/app/assets/stylesheets/_top_level_partial.css.scss +0 -3
  29. data/test/fixtures/alternate_config_project/app/assets/stylesheets/application.css.scss +0 -32
  30. data/test/fixtures/alternate_config_project/app/assets/stylesheets/css_application.css +0 -7
  31. data/test/fixtures/alternate_config_project/app/assets/stylesheets/globbed/globbed.css.scss +0 -3
  32. data/test/fixtures/alternate_config_project/app/assets/stylesheets/globbed/nested/nested_glob.css.scss +0 -3
  33. data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_sass_import.css.sass +0 -5
  34. data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_scss_import.css.scss +0 -9
  35. data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/_without_css_ext.scss +0 -3
  36. data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/_relative_sass.css.sass +0 -2
  37. data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/_relative_scss.css.scss +0 -3
  38. data/test/fixtures/alternate_config_project/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss +0 -3
  39. data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/another_plain.css +0 -3
  40. data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/plain.css +0 -3
  41. data/test/fixtures/alternate_config_project/app/assets/stylesheets/subfolder/second_level.css.scss +0 -1
  42. data/test/fixtures/alternate_config_project/app/controllers/application_controller.rb +0 -3
  43. data/test/fixtures/alternate_config_project/app/helpers/application_helper.rb +0 -2
  44. data/test/fixtures/alternate_config_project/app/mailers/.gitkeep +0 -0
  45. data/test/fixtures/alternate_config_project/app/models/.gitkeep +0 -0
  46. data/test/fixtures/alternate_config_project/app/views/layouts/application.html.erb +0 -14
  47. data/test/fixtures/alternate_config_project/config.ru +0 -4
  48. data/test/fixtures/alternate_config_project/config/application.rb +0 -49
  49. data/test/fixtures/alternate_config_project/config/boot.rb +0 -6
  50. data/test/fixtures/alternate_config_project/config/database.yml +0 -25
  51. data/test/fixtures/alternate_config_project/config/environment.rb +0 -5
  52. data/test/fixtures/alternate_config_project/config/environments/development.rb +0 -27
  53. data/test/fixtures/alternate_config_project/config/environments/production.rb +0 -56
  54. data/test/fixtures/alternate_config_project/config/environments/test.rb +0 -38
  55. data/test/fixtures/alternate_config_project/config/initializers/backtrace_silencers.rb +0 -7
  56. data/test/fixtures/alternate_config_project/config/initializers/inflections.rb +0 -10
  57. data/test/fixtures/alternate_config_project/config/initializers/mime_types.rb +0 -5
  58. data/test/fixtures/alternate_config_project/config/initializers/secret_token.rb +0 -7
  59. data/test/fixtures/alternate_config_project/config/initializers/session_store.rb +0 -8
  60. data/test/fixtures/alternate_config_project/config/initializers/wrap_parameters.rb +0 -12
  61. data/test/fixtures/alternate_config_project/config/locales/en.yml +0 -5
  62. data/test/fixtures/alternate_config_project/config/routes.rb +0 -58
  63. data/test/fixtures/alternate_config_project/db/seeds.rb +0 -7
  64. data/test/fixtures/alternate_config_project/doc/README_FOR_APP +0 -2
  65. data/test/fixtures/alternate_config_project/lib/tasks/.gitkeep +0 -0
  66. data/test/fixtures/alternate_config_project/log/.gitkeep +0 -0
  67. data/test/fixtures/alternate_config_project/public/404.html +0 -26
  68. data/test/fixtures/alternate_config_project/public/422.html +0 -26
  69. data/test/fixtures/alternate_config_project/public/500.html +0 -26
  70. data/test/fixtures/alternate_config_project/public/favicon.ico +0 -0
  71. data/test/fixtures/alternate_config_project/public/index.html +0 -241
  72. data/test/fixtures/alternate_config_project/public/robots.txt +0 -5
  73. data/test/fixtures/alternate_config_project/script/rails +0 -6
  74. data/test/fixtures/alternate_config_project/vendor/assets/stylesheets/.gitkeep +0 -0
  75. data/test/fixtures/alternate_config_project/vendor/plugins/.gitkeep +0 -0
  76. data/test/fixtures/engine_project/.gitignore +0 -8
  77. data/test/fixtures/engine_project/Gemfile +0 -14
  78. data/test/fixtures/engine_project/MIT-LICENSE +0 -20
  79. data/test/fixtures/engine_project/README.rdoc +0 -3
  80. data/test/fixtures/engine_project/Rakefile +0 -34
  81. data/test/fixtures/engine_project/app/assets/images/engine_project/.keep +0 -0
  82. data/test/fixtures/engine_project/app/assets/javascripts/engine_project/application.js +0 -16
  83. data/test/fixtures/engine_project/app/assets/stylesheets/engine_project/application.css +0 -13
  84. data/test/fixtures/engine_project/app/controllers/engine_project/application_controller.rb +0 -4
  85. data/test/fixtures/engine_project/app/helpers/engine_project/application_helper.rb +0 -4
  86. data/test/fixtures/engine_project/app/views/layouts/engine_project/application.html.erb +0 -14
  87. data/test/fixtures/engine_project/config/routes.rb +0 -2
  88. data/test/fixtures/engine_project/engine_project.gemspec +0 -23
  89. data/test/fixtures/engine_project/lib/engine_project.rb +0 -4
  90. data/test/fixtures/engine_project/lib/engine_project/engine.rb +0 -5
  91. data/test/fixtures/engine_project/lib/engine_project/version.rb +0 -3
  92. data/test/fixtures/engine_project/lib/tasks/engine_project_tasks.rake +0 -4
  93. data/test/fixtures/engine_project/script/rails +0 -8
  94. data/test/fixtures/engine_project/test/dummy/README.rdoc +0 -28
  95. data/test/fixtures/engine_project/test/dummy/Rakefile +0 -6
  96. data/test/fixtures/engine_project/test/dummy/app/assets/javascripts/application.js +0 -16
  97. data/test/fixtures/engine_project/test/dummy/app/assets/stylesheets/application.css +0 -13
  98. data/test/fixtures/engine_project/test/dummy/app/controllers/application_controller.rb +0 -5
  99. data/test/fixtures/engine_project/test/dummy/app/controllers/concerns/.keep +0 -0
  100. data/test/fixtures/engine_project/test/dummy/app/helpers/application_helper.rb +0 -2
  101. data/test/fixtures/engine_project/test/dummy/app/mailers/.keep +0 -0
  102. data/test/fixtures/engine_project/test/dummy/app/models/.keep +0 -0
  103. data/test/fixtures/engine_project/test/dummy/app/models/concerns/.keep +0 -0
  104. data/test/fixtures/engine_project/test/dummy/app/views/layouts/application.html.erb +0 -14
  105. data/test/fixtures/engine_project/test/dummy/bin/bundle +0 -3
  106. data/test/fixtures/engine_project/test/dummy/bin/rails +0 -4
  107. data/test/fixtures/engine_project/test/dummy/bin/rake +0 -4
  108. data/test/fixtures/engine_project/test/dummy/config.ru +0 -4
  109. data/test/fixtures/engine_project/test/dummy/config/application.rb +0 -23
  110. data/test/fixtures/engine_project/test/dummy/config/boot.rb +0 -9
  111. data/test/fixtures/engine_project/test/dummy/config/database.yml +0 -25
  112. data/test/fixtures/engine_project/test/dummy/config/environment.rb +0 -5
  113. data/test/fixtures/engine_project/test/dummy/config/environments/development.rb +0 -27
  114. data/test/fixtures/engine_project/test/dummy/config/environments/production.rb +0 -80
  115. data/test/fixtures/engine_project/test/dummy/config/environments/test.rb +0 -36
  116. data/test/fixtures/engine_project/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  117. data/test/fixtures/engine_project/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  118. data/test/fixtures/engine_project/test/dummy/config/initializers/inflections.rb +0 -16
  119. data/test/fixtures/engine_project/test/dummy/config/initializers/mime_types.rb +0 -5
  120. data/test/fixtures/engine_project/test/dummy/config/initializers/secret_token.rb +0 -12
  121. data/test/fixtures/engine_project/test/dummy/config/initializers/session_store.rb +0 -3
  122. data/test/fixtures/engine_project/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  123. data/test/fixtures/engine_project/test/dummy/config/locales/en.yml +0 -23
  124. data/test/fixtures/engine_project/test/dummy/config/routes.rb +0 -4
  125. data/test/fixtures/engine_project/test/dummy/lib/assets/.keep +0 -0
  126. data/test/fixtures/engine_project/test/dummy/log/.keep +0 -0
  127. data/test/fixtures/engine_project/test/dummy/public/404.html +0 -27
  128. data/test/fixtures/engine_project/test/dummy/public/422.html +0 -26
  129. data/test/fixtures/engine_project/test/dummy/public/500.html +0 -26
  130. data/test/fixtures/engine_project/test/dummy/public/favicon.ico +0 -0
  131. data/test/fixtures/sass_project/.gitignore +0 -5
  132. data/test/fixtures/sass_project/Gemfile +0 -7
  133. data/test/fixtures/sass_project/README +0 -261
  134. data/test/fixtures/sass_project/Rakefile +0 -7
  135. data/test/fixtures/sass_project/app/assets/images/rails.png +0 -0
  136. data/test/fixtures/sass_project/app/assets/javascripts/application.js +0 -9
  137. data/test/fixtures/sass_project/app/assets/stylesheets/application.css +0 -7
  138. data/test/fixtures/sass_project/app/controllers/application_controller.rb +0 -3
  139. data/test/fixtures/sass_project/app/helpers/application_helper.rb +0 -2
  140. data/test/fixtures/sass_project/app/mailers/.gitkeep +0 -0
  141. data/test/fixtures/sass_project/app/models/.gitkeep +0 -0
  142. data/test/fixtures/sass_project/app/views/layouts/application.html.erb +0 -14
  143. data/test/fixtures/sass_project/config.ru +0 -4
  144. data/test/fixtures/sass_project/config/application.rb +0 -52
  145. data/test/fixtures/sass_project/config/boot.rb +0 -6
  146. data/test/fixtures/sass_project/config/database.yml +0 -25
  147. data/test/fixtures/sass_project/config/environment.rb +0 -5
  148. data/test/fixtures/sass_project/config/environments/development.rb +0 -24
  149. data/test/fixtures/sass_project/config/environments/production.rb +0 -54
  150. data/test/fixtures/sass_project/config/environments/test.rb +0 -39
  151. data/test/fixtures/sass_project/config/initializers/backtrace_silencers.rb +0 -7
  152. data/test/fixtures/sass_project/config/initializers/inflections.rb +0 -10
  153. data/test/fixtures/sass_project/config/initializers/mime_types.rb +0 -5
  154. data/test/fixtures/sass_project/config/initializers/secret_token.rb +0 -7
  155. data/test/fixtures/sass_project/config/initializers/session_store.rb +0 -8
  156. data/test/fixtures/sass_project/config/initializers/wrap_parameters.rb +0 -12
  157. data/test/fixtures/sass_project/config/locales/en.yml +0 -5
  158. data/test/fixtures/sass_project/config/routes.rb +0 -58
  159. data/test/fixtures/sass_project/db/seeds.rb +0 -7
  160. data/test/fixtures/sass_project/doc/README_FOR_APP +0 -2
  161. data/test/fixtures/sass_project/lib/tasks/.gitkeep +0 -0
  162. data/test/fixtures/sass_project/log/.gitkeep +0 -0
  163. data/test/fixtures/sass_project/public/404.html +0 -26
  164. data/test/fixtures/sass_project/public/422.html +0 -26
  165. data/test/fixtures/sass_project/public/500.html +0 -26
  166. data/test/fixtures/sass_project/public/favicon.ico +0 -0
  167. data/test/fixtures/sass_project/public/index.html +0 -241
  168. data/test/fixtures/sass_project/public/robots.txt +0 -5
  169. data/test/fixtures/sass_project/script/rails +0 -6
  170. data/test/fixtures/sass_project/vendor/assets/stylesheets/.gitkeep +0 -0
  171. data/test/fixtures/sass_project/vendor/plugins/.gitkeep +0 -0
  172. data/test/fixtures/scss_project/.gitignore +0 -5
  173. data/test/fixtures/scss_project/Gemfile +0 -7
  174. data/test/fixtures/scss_project/README +0 -261
  175. data/test/fixtures/scss_project/Rakefile +0 -7
  176. data/test/fixtures/scss_project/app/assets/images/1x1.png +0 -0
  177. data/test/fixtures/scss_project/app/assets/images/rails.png +0 -0
  178. data/test/fixtures/scss_project/app/assets/javascripts/application.js +0 -9
  179. data/test/fixtures/scss_project/app/assets/stylesheets/_top_level_partial.css.scss +0 -3
  180. data/test/fixtures/scss_project/app/assets/stylesheets/application.css.scss +0 -37
  181. data/test/fixtures/scss_project/app/assets/stylesheets/css_application.css +0 -7
  182. data/test/fixtures/scss_project/app/assets/stylesheets/css_erb_handler.css.erb +0 -3
  183. data/test/fixtures/scss_project/app/assets/stylesheets/css_sass_erb_handler.css.sass.erb +0 -2
  184. data/test/fixtures/scss_project/app/assets/stylesheets/css_scss_erb_handler.css.scss.erb +0 -3
  185. data/test/fixtures/scss_project/app/assets/stylesheets/globbed/globbed.css.scss +0 -3
  186. data/test/fixtures/scss_project/app/assets/stylesheets/globbed/nested/nested_glob.css.scss +0 -3
  187. data/test/fixtures/scss_project/app/assets/stylesheets/partials/_sass_import.css.sass +0 -5
  188. data/test/fixtures/scss_project/app/assets/stylesheets/partials/_scss_import.css.scss +0 -9
  189. data/test/fixtures/scss_project/app/assets/stylesheets/partials/_without_css_ext.scss +0 -3
  190. data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/_relative_sass.css.sass +0 -2
  191. data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/_relative_scss.css.scss +0 -3
  192. data/test/fixtures/scss_project/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss +0 -3
  193. data/test/fixtures/scss_project/app/assets/stylesheets/sass_erb_handler.sass.erb +0 -2
  194. data/test/fixtures/scss_project/app/assets/stylesheets/scss_erb_handler.scss.erb +0 -3
  195. data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/_defaults.css.scss +0 -3
  196. data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/another_plain.css +0 -3
  197. data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/plain.css +0 -3
  198. data/test/fixtures/scss_project/app/assets/stylesheets/subfolder/second_level.css.scss +0 -2
  199. data/test/fixtures/scss_project/app/controllers/application_controller.rb +0 -3
  200. data/test/fixtures/scss_project/app/helpers/application_helper.rb +0 -2
  201. data/test/fixtures/scss_project/app/mailers/.gitkeep +0 -0
  202. data/test/fixtures/scss_project/app/models/.gitkeep +0 -0
  203. data/test/fixtures/scss_project/app/views/layouts/application.html.erb +0 -14
  204. data/test/fixtures/scss_project/config.ru +0 -4
  205. data/test/fixtures/scss_project/config/application.rb +0 -49
  206. data/test/fixtures/scss_project/config/boot.rb +0 -6
  207. data/test/fixtures/scss_project/config/database.yml +0 -25
  208. data/test/fixtures/scss_project/config/environment.rb +0 -5
  209. data/test/fixtures/scss_project/config/environments/development.rb +0 -23
  210. data/test/fixtures/scss_project/config/environments/production.rb +0 -53
  211. data/test/fixtures/scss_project/config/environments/test.rb +0 -38
  212. data/test/fixtures/scss_project/config/initializers/backtrace_silencers.rb +0 -7
  213. data/test/fixtures/scss_project/config/initializers/inflections.rb +0 -10
  214. data/test/fixtures/scss_project/config/initializers/mime_types.rb +0 -5
  215. data/test/fixtures/scss_project/config/initializers/postprocessor.rb +0 -3
  216. data/test/fixtures/scss_project/config/initializers/secret_token.rb +0 -7
  217. data/test/fixtures/scss_project/config/initializers/session_store.rb +0 -8
  218. data/test/fixtures/scss_project/config/initializers/wrap_parameters.rb +0 -12
  219. data/test/fixtures/scss_project/config/locales/en.yml +0 -5
  220. data/test/fixtures/scss_project/config/routes.rb +0 -58
  221. data/test/fixtures/scss_project/db/seeds.rb +0 -7
  222. data/test/fixtures/scss_project/doc/README_FOR_APP +0 -2
  223. data/test/fixtures/scss_project/lib/tasks/.gitkeep +0 -0
  224. data/test/fixtures/scss_project/log/.gitkeep +0 -0
  225. data/test/fixtures/scss_project/public/404.html +0 -26
  226. data/test/fixtures/scss_project/public/422.html +0 -26
  227. data/test/fixtures/scss_project/public/500.html +0 -26
  228. data/test/fixtures/scss_project/public/favicon.ico +0 -0
  229. data/test/fixtures/scss_project/public/index.html +0 -241
  230. data/test/fixtures/scss_project/public/robots.txt +0 -5
  231. data/test/fixtures/scss_project/script/rails +0 -6
  232. data/test/fixtures/scss_project/vendor/assets/stylesheets/.gitkeep +0 -0
  233. data/test/fixtures/scss_project/vendor/plugins/.gitkeep +0 -0
  234. data/test/gemfiles/Gemfile-4-0-stable +0 -9
  235. data/test/gemfiles/Gemfile-4-1-stable +0 -9
  236. data/test/gemfiles/Gemfile-master +0 -9
  237. data/test/sass_rails_generators_test.rb +0 -62
  238. data/test/sass_rails_logger_test.rb +0 -27
  239. data/test/sass_rails_test.rb +0 -157
  240. data/test/support/sass_rails_test_case.rb +0 -181
  241. data/test/test_helper.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48440623f66d3f63e45218b96959bb726ce72ea2
4
- data.tar.gz: 635bdea2f7044d1c4c111d9023d80f0858c8c776
3
+ metadata.gz: 7e8d1de04c3b2051b0aab8f75e4aab8fb1bbd150
4
+ data.tar.gz: 510bf6be01cd389f355589ef1e323e47b18cea7d
5
5
  SHA512:
6
- metadata.gz: 187cf250f24ccd61482158404450b063f3c7e6cb8f31f814e457ea0bf44c5200d8f16faec87450c4efe998732af5d3c6f2a644c10a5c97a87c123e9ca229992a
7
- data.tar.gz: 5d8b55270d3eae58dc8bd17328ea347eb87e5a56e5cdc3e946147daaf64d74d16ce3918b90947ff12f96e911620c852afbeeccf4b9e2314b9f565b38e3bc4012
6
+ metadata.gz: 7d78a7e4a55fd6d9ca44a612051ed5d260b379f92ac763b421f053f525a468e31644d468d759fba9015db5d4641276ed63a86b0ea732cf0f072e4cbacf6a67e0
7
+ data.tar.gz: 86b70308e42217a83c48f0ba8899bfcd2a135a02ddd78517f1a99e8206ea8def3c87deb0814fe9612dc58669a39cc4c1c38f229c7bbdae20c4c5b0d13ea9f57a
@@ -1,8 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
- ## unreleased
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.css.sass", File.join('app/assets/stylesheets', class_path, "#{file_name}.css.sass")
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.css.#{syntax}", converted_contents
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.css.scss", File.join('app/assets/stylesheets', class_path, "#{file_name}.css.scss")
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
@@ -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
@@ -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
- GLOB = /\*|\[.+\]/
9
+ module Globbing
10
+ GLOB = /(\A|\/)(\*|\*\*\/\*)\z/
7
11
 
8
- attr_reader :context
9
- def initialize(context, *args)
10
- @context = context
11
- super(*args)
12
- end
13
-
14
- def extensions
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
- def find(name, options)
36
- if name =~ GLOB
37
- nil # globs must be relative
38
- else
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
- private
44
-
45
- def each_globbed_file(glob, base_pathname, options)
46
- Dir["#{base_pathname}/#{glob}"].sort.each do |filename|
47
- next if filename == options[:filename]
48
- if File.directory?(filename)
49
- context.depend_on(filename)
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
- def glob_imports(glob, base_pathname, options)
59
- contents = ""
60
- each_globbed_file(glob, base_pathname.dirname, options) do |filename|
61
- contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
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
- return nil if contents.empty?
64
- Sass::Engine.new(contents, options.merge(
65
- :filename => base_pathname.to_s,
66
- :importer => self,
67
- :syntax => :scss
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 engine_from_path(name, dir, options)
73
- full_filename, syntax = Sass::Util.destructure(find_real_file(dir, name, options))
74
- return unless full_filename && File.readable?(full_filename)
77
+ def find_relative(*args)
78
+ process_erb_engine(super)
79
+ end
75
80
 
76
- context.depend_on full_filename
77
- engine = Sass::Engine.new(evaluate(full_filename), options.merge(
78
- syntax: syntax,
79
- filename: full_filename,
80
- importer: self
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
- engine
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 evaluate(filename)
87
- attributes = context.environment.attributes_for(filename)
88
- processors = context.environment.preprocessors(attributes.content_type) +
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
- context.evaluate(filename, processors: processors)
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
@@ -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.extend(SassContext)
63
- app.assets.context_class.sass_config = app.config.sass
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
@@ -1,39 +1,69 @@
1
- require "sprockets/sass_template"
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 < Sprockets::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 = Sprockets::SassCacheStore.new(context.environment)
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 => SassImporter.new(context, context.pathname.to_s),
16
- :load_paths => context.environment.paths.map { |path| SassImporter.new(context, path.to_s) },
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.environment.context_class.sass_config.merge(options)
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
- ::Sass::Engine.new(data, sass_config).render
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
- class ScssTemplate < SassTemplate
33
- def self.default_mime_type
34
- 'text/css'
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