sass-rails 4.0.5 → 5.0.7

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