sass-rails 3.2.3 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +1 -1
- data/README.md +103 -0
- data/lib/sass/rails/importer.rb +3 -120
- data/lib/sass/rails/logger.rb +3 -19
- data/lib/sass/rails/railtie.rb +1 -77
- data/lib/sass/rails/version.rb +1 -1
- data/lib/sass/rails.rb +1 -16
- data/lib/sass-rails.rb +1 -1
- metadata +42 -408
- data/.gitignore +0 -5
- data/.travis.yml +0 -12
- data/CHANGELOG.md +0 -20
- data/Gemfile +0 -17
- data/README.markdown +0 -75
- data/Rakefile +0 -12
- data/lib/rails/generators/sass/assets/assets_generator.rb +0 -13
- data/lib/rails/generators/sass/assets/templates/stylesheet.css.sass +0 -3
- data/lib/rails/generators/sass/scaffold/scaffold_generator.rb +0 -9
- data/lib/rails/generators/sass_scaffold.rb +0 -16
- data/lib/rails/generators/scss/assets/assets_generator.rb +0 -13
- data/lib/rails/generators/scss/assets/templates/stylesheet.css.scss +0 -3
- data/lib/rails/generators/scss/scaffold/scaffold_generator.rb +0 -10
- data/lib/sass/rails/compressor.rb +0 -19
- data/lib/sass/rails/helpers.rb +0 -52
- data/lib/sass/rails/template_handlers.rb +0 -117
- data/sass-rails.gemspec +0 -25
- data/test/fixtures/engine_project/.gitignore +0 -6
- data/test/fixtures/engine_project/Gemfile +0 -5
- data/test/fixtures/engine_project/README.rdoc +0 -3
- data/test/fixtures/engine_project/Rakefile +0 -39
- data/test/fixtures/engine_project/app/assets/images/engine_project/.gitkeep +0 -0
- data/test/fixtures/engine_project/app/assets/javascripts/engine_project/application.js +0 -9
- data/test/fixtures/engine_project/app/assets/stylesheets/engine_project/application.css +0 -7
- 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/db/seeds.rb +0 -7
- data/test/fixtures/engine_project/engine_project.gemspec +0 -8
- data/test/fixtures/engine_project/lib/engine_project/engine.rb +0 -5
- data/test/fixtures/engine_project/lib/engine_project/version.rb +0 -3
- data/test/fixtures/engine_project/lib/engine_project.rb +0 -4
- data/test/fixtures/engine_project/lib/tasks/engine_project_tasks.rake +0 -4
- data/test/fixtures/engine_project/script/rails +0 -6
- data/test/fixtures/engine_project/test/dummy/Rakefile +0 -7
- data/test/fixtures/engine_project/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/fixtures/engine_project/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/fixtures/engine_project/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/fixtures/engine_project/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/engine_project/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/fixtures/engine_project/test/dummy/app/models/.gitkeep +0 -0
- data/test/fixtures/engine_project/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/engine_project/test/dummy/config/application.rb +0 -42
- data/test/fixtures/engine_project/test/dummy/config/boot.rb +0 -10
- 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 -51
- data/test/fixtures/engine_project/test/dummy/config/environments/test.rb +0 -39
- data/test/fixtures/engine_project/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/fixtures/engine_project/test/dummy/config/initializers/inflections.rb +0 -10
- 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 -7
- data/test/fixtures/engine_project/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/fixtures/engine_project/test/dummy/config/initializers/wrap_parameters.rb +0 -12
- data/test/fixtures/engine_project/test/dummy/config/locales/en.yml +0 -5
- data/test/fixtures/engine_project/test/dummy/config/routes.rb +0 -4
- data/test/fixtures/engine_project/test/dummy/config.ru +0 -4
- data/test/fixtures/engine_project/test/dummy/db/seeds.rb +0 -7
- data/test/fixtures/engine_project/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/fixtures/engine_project/test/dummy/log/.gitkeep +0 -0
- data/test/fixtures/engine_project/test/dummy/public/404.html +0 -26
- 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/engine_project/test/dummy/script/rails +0 -6
- data/test/fixtures/sass_project/.gitignore +0 -5
- data/test/fixtures/sass_project/Gemfile +0 -7
- data/test/fixtures/sass_project/README +0 -261
- data/test/fixtures/sass_project/Rakefile +0 -7
- data/test/fixtures/sass_project/app/assets/images/rails.png +0 -0
- data/test/fixtures/sass_project/app/assets/javascripts/application.js +0 -9
- data/test/fixtures/sass_project/app/assets/stylesheets/application.css +0 -7
- data/test/fixtures/sass_project/app/controllers/application_controller.rb +0 -3
- data/test/fixtures/sass_project/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/sass_project/app/mailers/.gitkeep +0 -0
- data/test/fixtures/sass_project/app/models/.gitkeep +0 -0
- data/test/fixtures/sass_project/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/sass_project/config/application.rb +0 -52
- data/test/fixtures/sass_project/config/boot.rb +0 -6
- data/test/fixtures/sass_project/config/database.yml +0 -25
- data/test/fixtures/sass_project/config/environment.rb +0 -5
- data/test/fixtures/sass_project/config/environments/development.rb +0 -27
- 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/config.ru +0 -4
- data/test/fixtures/sass_project/db/seeds.rb +0 -7
- data/test/fixtures/sass_project/doc/README_FOR_APP +0 -2
- data/test/fixtures/sass_project/lib/tasks/.gitkeep +0 -0
- data/test/fixtures/sass_project/log/.gitkeep +0 -0
- data/test/fixtures/sass_project/public/404.html +0 -26
- data/test/fixtures/sass_project/public/422.html +0 -26
- data/test/fixtures/sass_project/public/500.html +0 -26
- data/test/fixtures/sass_project/public/favicon.ico +0 -0
- data/test/fixtures/sass_project/public/index.html +0 -241
- data/test/fixtures/sass_project/public/robots.txt +0 -5
- data/test/fixtures/sass_project/script/rails +0 -6
- data/test/fixtures/sass_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/fixtures/sass_project/vendor/plugins/.gitkeep +0 -0
- data/test/fixtures/scss_project/.gitignore +0 -5
- data/test/fixtures/scss_project/Gemfile +0 -7
- data/test/fixtures/scss_project/README +0 -261
- data/test/fixtures/scss_project/Rakefile +0 -7
- data/test/fixtures/scss_project/app/assets/images/1x1.png +0 -0
- data/test/fixtures/scss_project/app/assets/images/rails.png +0 -0
- data/test/fixtures/scss_project/app/assets/javascripts/application.js +0 -9
- data/test/fixtures/scss_project/app/assets/stylesheets/_top_level_partial.css.scss +0 -3
- data/test/fixtures/scss_project/app/assets/stylesheets/application.css.scss +0 -32
- data/test/fixtures/scss_project/app/assets/stylesheets/css_application.css +0 -7
- 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/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 -1
- data/test/fixtures/scss_project/app/controllers/application_controller.rb +0 -3
- data/test/fixtures/scss_project/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/scss_project/app/mailers/.gitkeep +0 -0
- data/test/fixtures/scss_project/app/models/.gitkeep +0 -0
- data/test/fixtures/scss_project/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/scss_project/config/application.rb +0 -49
- data/test/fixtures/scss_project/config/boot.rb +0 -6
- data/test/fixtures/scss_project/config/database.yml +0 -25
- data/test/fixtures/scss_project/config/environment.rb +0 -5
- data/test/fixtures/scss_project/config/environments/development.rb +0 -27
- data/test/fixtures/scss_project/config/environments/production.rb +0 -54
- data/test/fixtures/scss_project/config/environments/test.rb +0 -39
- 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/secret_token.rb +0 -7
- data/test/fixtures/scss_project/config/initializers/session_store.rb +0 -8
- data/test/fixtures/scss_project/config/initializers/wrap_parameters.rb +0 -12
- data/test/fixtures/scss_project/config/locales/en.yml +0 -5
- data/test/fixtures/scss_project/config/routes.rb +0 -58
- data/test/fixtures/scss_project/config.ru +0 -4
- data/test/fixtures/scss_project/db/seeds.rb +0 -7
- data/test/fixtures/scss_project/doc/README_FOR_APP +0 -2
- data/test/fixtures/scss_project/lib/tasks/.gitkeep +0 -0
- data/test/fixtures/scss_project/log/.gitkeep +0 -0
- data/test/fixtures/scss_project/public/404.html +0 -26
- data/test/fixtures/scss_project/public/422.html +0 -26
- data/test/fixtures/scss_project/public/500.html +0 -26
- data/test/fixtures/scss_project/public/favicon.ico +0 -0
- data/test/fixtures/scss_project/public/index.html +0 -241
- data/test/fixtures/scss_project/public/robots.txt +0 -5
- data/test/fixtures/scss_project/script/rails +0 -6
- data/test/fixtures/scss_project/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/fixtures/scss_project/vendor/plugins/.gitkeep +0 -0
- data/test/sass_rails_logger_test.rb +0 -24
- data/test/sass_rails_test.rb +0 -110
- data/test/support/sass_rails_test_case.rb +0 -159
- data/test/test_helper.rb +0 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d162298f6dcc547ef3c5e3e51d6d5bca7df731e8161737f03b01b05e3c77aba3
|
4
|
+
data.tar.gz: 2f10eb26a35786fa327e5ede671c6e487881c6bf85cce2eea5481aec63ab99db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4862c7852e9d3928e48ef3d8a314e8872557d94345a8a8845f6c3fc7f80e0166947c07fbf09d11505a86b3f8075d933f5576c45ef5d90eadcf0980707cbf549e
|
7
|
+
data.tar.gz: 75616f8708d8f20b2d32d84adf73d779c193c18d6ac7784a3d9ba10fc4309e7694dc39f09087daf6ec993357e363ebe2d2e3292160ae4e2944ed6e50f105a3da
|
data/MIT-LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# Official Ruby-on-Rails Integration with Sass
|
2
|
+
|
3
|
+
This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language.
|
4
|
+
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Since Rails 3.1, new Rails projects will be already configured to use Sass. If you are upgrading to Rails 3.1 you will need to add the following to your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'sass-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
## Configuration
|
14
|
+
|
15
|
+
To configure Sass via Rails set use `config.sass` in your
|
16
|
+
application and/or environment files to set configuration
|
17
|
+
properties that will be passed to Sass.
|
18
|
+
|
19
|
+
### Options
|
20
|
+
|
21
|
+
- `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).
|
22
|
+
|
23
|
+
The [list of supported Sass options](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#options)
|
24
|
+
can be found on the Sass Website with the following caveats:
|
25
|
+
|
26
|
+
- `:style` - This option is not supported. This is determined by the Rails environment. It's `:expanded` only on development, otherwise it's `:compressed`.
|
27
|
+
- `:never_update` - This option is not supported. Instead set `config.assets.enabled = false`
|
28
|
+
- `: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.
|
29
|
+
- `:always_check` - This option is not supported. Sprockets always checks in development.
|
30
|
+
- `:syntax` - This is determined by the file's extensions.
|
31
|
+
- `:filename` - This is determined by the file's name.
|
32
|
+
- `:line` - This is provided by the template handler.
|
33
|
+
|
34
|
+
### Example
|
35
|
+
```ruby
|
36
|
+
MyProject::Application.configure do
|
37
|
+
config.sass.preferred_syntax = :sass
|
38
|
+
config.sass.line_comments = false
|
39
|
+
config.sass.cache = false
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
## Important Note
|
44
|
+
|
45
|
+
Sprockets provides some directives that are placed inside of comments called `require`, `require_tree`, and
|
46
|
+
`require_self`. **<span style="color:#c00">DO NOT USE THEM IN YOUR SASS/SCSS FILES.</span>** They are very
|
47
|
+
primitive and do not work well with Sass files. Instead, use Sass's native `@import` directive which
|
48
|
+
`sass-rails` has customized to integrate with the conventions of your Rails projects.
|
49
|
+
|
50
|
+
## Features
|
51
|
+
|
52
|
+
### Glob Imports
|
53
|
+
|
54
|
+
When in Rails, there is a special import syntax that allows you to
|
55
|
+
glob imports relative to the folder of the stylesheet that is doing the importing.
|
56
|
+
|
57
|
+
* `@import "mixins/*"` will import all the files in the mixins folder
|
58
|
+
* `@import "mixins/**/*"` will import all the files in the mixins tree
|
59
|
+
|
60
|
+
Any valid ruby glob may be used. The imports are sorted alphabetically.
|
61
|
+
|
62
|
+
**NOTE:** It is recommended that you only use this when importing pure library
|
63
|
+
files (containing mixins and variables) because it is difficult to control the
|
64
|
+
cascade ordering for imports that contain styles using this approach.
|
65
|
+
|
66
|
+
### Asset Helpers
|
67
|
+
When using the asset pipeline, paths to assets must be rewritten.
|
68
|
+
When referencing assets use the following asset helpers (underscored in Ruby, hyphenated
|
69
|
+
in Sass):
|
70
|
+
|
71
|
+
#### `asset-path($relative-asset-path)`
|
72
|
+
Returns a string to the asset.
|
73
|
+
|
74
|
+
* `asset-path("rails.png")` returns `"/assets/rails.png"`
|
75
|
+
|
76
|
+
#### `asset-url($relative-asset-path)`
|
77
|
+
Returns a url reference to the asset.
|
78
|
+
|
79
|
+
* `asset-url("rails.png")` returns `url(/assets/rails.png)`
|
80
|
+
|
81
|
+
As a convenience, for each of the following asset classes there are
|
82
|
+
corresponding `-path` and `-url` helpers:
|
83
|
+
image, font, video, audio, javascript, stylesheet.
|
84
|
+
|
85
|
+
* `image-path("rails.png")` returns `"/assets/rails.png"`
|
86
|
+
* `image-url("rails.png")` returns `url(/assets/rails.png)`
|
87
|
+
|
88
|
+
#### `asset-data-url($relative-asset-path)`
|
89
|
+
Returns a url reference to the Base64-encoded asset at the specified path.
|
90
|
+
|
91
|
+
* `asset-data-url("rails.png")` returns `url(data:image/png;base64,iVBORw0K...)`
|
92
|
+
|
93
|
+
## Running Tests
|
94
|
+
|
95
|
+
$ bundle install
|
96
|
+
$ bundle exec rake test
|
97
|
+
|
98
|
+
If you need to test against local gems, use Bundler's gem :path option in the Gemfile and also edit `test/support/test_helper.rb` and tell the tests where the gem is checked out.
|
99
|
+
|
100
|
+
## Code Status
|
101
|
+
|
102
|
+
* [](http://travis-ci.org/rails/sass-rails)
|
103
|
+
* [](http://badge.fury.io/rb/sass-rails)
|
data/lib/sass/rails/importer.rb
CHANGED
@@ -1,122 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
class Importer
|
5
|
-
GLOB = /\*|\[.+\]/
|
6
|
-
PARTIAL = /^_/
|
7
|
-
HAS_EXTENSION = /\.css(.s[ac]ss)?$/
|
3
|
+
require "active_support/deprecation"
|
8
4
|
|
9
|
-
|
10
|
-
".css.sass" => :sass,
|
11
|
-
".css.scss" => :scss,
|
12
|
-
".sass" => :sass,
|
13
|
-
".scss" => :scss
|
14
|
-
}
|
15
|
-
attr_reader :context
|
16
|
-
|
17
|
-
def initialize(context)
|
18
|
-
@context = context
|
19
|
-
@resolver = Resolver.new(context)
|
20
|
-
end
|
21
|
-
|
22
|
-
def sass_file?(filename)
|
23
|
-
filename = filename.to_s
|
24
|
-
SASS_EXTENSIONS.keys.any?{|ext| filename[ext]}
|
25
|
-
end
|
26
|
-
|
27
|
-
def syntax(filename)
|
28
|
-
filename = filename.to_s
|
29
|
-
SASS_EXTENSIONS.each {|ext, syntax| return syntax if filename[(ext.size+2)..-1][ext]}
|
30
|
-
nil
|
31
|
-
end
|
32
|
-
|
33
|
-
def resolve(name, base_pathname = nil)
|
34
|
-
name = Pathname.new(name)
|
35
|
-
if base_pathname && base_pathname.to_s.size > 0
|
36
|
-
root = Pathname.new(context.root_path)
|
37
|
-
name = base_pathname.relative_path_from(root).join(name)
|
38
|
-
end
|
39
|
-
partial_name = name.dirname.join("_#{name.basename}")
|
40
|
-
@resolver.resolve(name) || @resolver.resolve(partial_name)
|
41
|
-
end
|
42
|
-
|
43
|
-
def find_relative(name, base, options)
|
44
|
-
base_pathname = Pathname.new(base)
|
45
|
-
if name =~ GLOB
|
46
|
-
glob_imports(name, base_pathname, options)
|
47
|
-
elsif pathname = resolve(name, base_pathname.dirname)
|
48
|
-
context.depend_on(pathname)
|
49
|
-
if sass_file?(pathname)
|
50
|
-
Sass::Engine.new(pathname.read, options.merge(:filename => pathname.to_s, :importer => self, :syntax => syntax(pathname)))
|
51
|
-
else
|
52
|
-
Sass::Engine.new(@resolver.process(pathname), options.merge(:filename => pathname.to_s, :importer => self, :syntax => :scss))
|
53
|
-
end
|
54
|
-
else
|
55
|
-
nil
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def find(name, options)
|
60
|
-
if name =~ GLOB
|
61
|
-
nil # globs must be relative
|
62
|
-
elsif pathname = resolve(name)
|
63
|
-
context.depend_on(pathname)
|
64
|
-
if sass_file?(pathname)
|
65
|
-
Sass::Engine.new(pathname.read, options.merge(:filename => pathname.to_s, :importer => self, :syntax => syntax(pathname)))
|
66
|
-
else
|
67
|
-
Sass::Engine.new(@resolver.process(pathname), options.merge(:filename => pathname.to_s, :importer => self, :syntax => :scss))
|
68
|
-
end
|
69
|
-
else
|
70
|
-
nil
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def each_globbed_file(glob, base_pathname, options)
|
75
|
-
Dir["#{base_pathname}/#{glob}"].sort.each do |filename|
|
76
|
-
next if filename == options[:filename]
|
77
|
-
yield filename if File.directory?(filename) || context.asset_requirable?(filename)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def glob_imports(glob, base_pathname, options)
|
82
|
-
contents = ""
|
83
|
-
each_globbed_file(glob, base_pathname.dirname, options) do |filename|
|
84
|
-
if File.directory?(filename)
|
85
|
-
context.depend_on(filename)
|
86
|
-
elsif context.asset_requirable?(filename)
|
87
|
-
context.depend_on(filename)
|
88
|
-
contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
return nil if contents.empty?
|
92
|
-
Sass::Engine.new(contents, options.merge(
|
93
|
-
:filename => base_pathname.to_s,
|
94
|
-
:importer => self,
|
95
|
-
:syntax => :scss
|
96
|
-
))
|
97
|
-
end
|
98
|
-
|
99
|
-
def mtime(name, options)
|
100
|
-
if name =~ GLOB && options[:filename]
|
101
|
-
mtime = nil
|
102
|
-
each_globbed_file(name, Pathname.new(options[:filename]).dirname, options) do |p|
|
103
|
-
mtime ||= File.mtime(p)
|
104
|
-
mtime = [mtime, File.mtime(p)].max
|
105
|
-
end
|
106
|
-
mtime
|
107
|
-
elsif pathname = resolve(name)
|
108
|
-
pathname.mtime
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def key(name, options)
|
113
|
-
["Sprockets:" + File.dirname(File.expand_path(name)), File.basename(name)]
|
114
|
-
end
|
115
|
-
|
116
|
-
def to_s
|
117
|
-
"Sass::Rails::Importer(#{context.pathname})"
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|
5
|
+
ActiveSupport::Deprecation.warn "Sass::Rails::Importer has been removed, please use SassC::Rails::Importer instead."
|
data/lib/sass/rails/logger.rb
CHANGED
@@ -1,21 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
module Rails
|
5
|
-
class Logger < Sass::Logger::Base
|
6
|
-
def _log(level, message)
|
3
|
+
require "active_support/deprecation"
|
7
4
|
|
8
|
-
|
9
|
-
when :trace, :debug
|
10
|
-
::Rails.logger.debug message
|
11
|
-
when :warn
|
12
|
-
::Rails.logger.warn message
|
13
|
-
when :error
|
14
|
-
::Rails.logger.error message
|
15
|
-
when :info
|
16
|
-
::Rails.logger.info message
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
5
|
+
ActiveSupport::Deprecation.warn "Sass::Rails::Logger has been removed, please stop requiring sass/rails/logger."
|
data/lib/sass/rails/railtie.rb
CHANGED
@@ -1,77 +1 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
module Sass::Rails
|
4
|
-
class Railtie < ::Rails::Railtie
|
5
|
-
module SassContext
|
6
|
-
attr_accessor :sass_config
|
7
|
-
end
|
8
|
-
|
9
|
-
config.sass = ActiveSupport::OrderedOptions.new
|
10
|
-
|
11
|
-
# Establish static configuration defaults
|
12
|
-
# Emit scss files during stylesheet generation of scaffold
|
13
|
-
config.sass.preferred_syntax = :scss
|
14
|
-
# Use expanded output instead of the sass default of :nested
|
15
|
-
config.sass.style = :expanded
|
16
|
-
# Write sass cache files for performance
|
17
|
-
config.sass.cache = true
|
18
|
-
# Read sass cache files for performance
|
19
|
-
config.sass.read_cache = true
|
20
|
-
# Display line comments above each selector as a debugging aid
|
21
|
-
config.sass.line_comments = true
|
22
|
-
# Initialize the load paths to an empty array
|
23
|
-
config.sass.load_paths = []
|
24
|
-
# Send Sass logs to Rails.logger
|
25
|
-
config.sass.logger = Sass::Rails::Logger.new
|
26
|
-
|
27
|
-
# Set the default stylesheet engine
|
28
|
-
# It can be overridedden by passing:
|
29
|
-
# --stylesheet_engine=sass
|
30
|
-
# to the rails generate command
|
31
|
-
config.app_generators.stylesheet_engine config.sass.preferred_syntax
|
32
|
-
|
33
|
-
config.before_initialize do |app|
|
34
|
-
require 'sass'
|
35
|
-
|
36
|
-
if app.config.assets.enabled
|
37
|
-
require 'sprockets'
|
38
|
-
Sprockets::Engines #force autoloading
|
39
|
-
Sprockets.register_engine '.sass', Sass::Rails::SassTemplate
|
40
|
-
Sprockets.register_engine '.scss', Sass::Rails::ScssTemplate
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
initializer :setup_sass, :group => :all do |app|
|
45
|
-
# Only emit one kind of syntax because though we have registered two kinds of generators
|
46
|
-
syntax = app.config.sass.preferred_syntax.to_sym
|
47
|
-
alt_syntax = syntax == :sass ? "scss" : "sass"
|
48
|
-
app.config.generators.hide_namespace alt_syntax
|
49
|
-
|
50
|
-
# Override stylesheet engine to the preferred syntax
|
51
|
-
config.app_generators.stylesheet_engine syntax
|
52
|
-
|
53
|
-
# Set the sass cache location
|
54
|
-
config.sass.cache_location = File.join(Rails.root, "tmp/cache/sass")
|
55
|
-
|
56
|
-
# Establish configuration defaults that are evironmental in nature
|
57
|
-
if config.sass.full_exception.nil?
|
58
|
-
# Display a stack trace in the css output when in development-like environments.
|
59
|
-
config.sass.full_exception = app.config.consider_all_requests_local
|
60
|
-
end
|
61
|
-
|
62
|
-
if app.assets
|
63
|
-
app.assets.context_class.extend(SassContext)
|
64
|
-
app.assets.context_class.sass_config = app.config.sass
|
65
|
-
end
|
66
|
-
|
67
|
-
Sass.logger = app.config.sass.logger
|
68
|
-
end
|
69
|
-
|
70
|
-
initializer :setup_compression, :group => :all do |app|
|
71
|
-
if app.config.assets.compress
|
72
|
-
app.config.sass.style = :compressed
|
73
|
-
app.config.assets.css_compressor = CssCompressor.new
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
1
|
+
require 'sassc/rails/railtie'
|
data/lib/sass/rails/version.rb
CHANGED
data/lib/sass/rails.rb
CHANGED
@@ -1,16 +1 @@
|
|
1
|
-
|
2
|
-
autoload :Script, 'sass/rails/helpers'
|
3
|
-
|
4
|
-
module Rails
|
5
|
-
autoload :CssCompressor, 'sass/rails/compressor'
|
6
|
-
autoload :Importer, 'sass/rails/importer'
|
7
|
-
autoload :Logger, 'sass/rails/logger'
|
8
|
-
autoload :Resolver, 'sass/rails/template_handlers'
|
9
|
-
autoload :SassTemplate, 'sass/rails/template_handlers'
|
10
|
-
autoload :ScssTemplate, 'sass/rails/template_handlers'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'sass/rails/version'
|
15
|
-
require 'sass/rails/helpers'
|
16
|
-
require 'sass/rails/railtie'
|
1
|
+
require 'sassc/rails'
|
data/lib/sass-rails.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require '
|
1
|
+
require 'sassc/rails'
|