sprockets-sass 1.3.1 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.reek +12 -0
- data/.rubocop.yml +77 -0
- data/.travis.yml +16 -0
- data/Appraisals +32 -15
- data/Gemfile +5 -0
- data/README.md +41 -4
- data/Rakefile +15 -3
- data/gemfiles/compass_0.11.gemfile +1 -1
- data/gemfiles/sass_3.1.gemfile +1 -1
- data/gemfiles/sass_3.3.gemfile +8 -0
- data/gemfiles/sass_3.4.gemfile +8 -0
- data/gemfiles/sprockets_2.10.gemfile +1 -1
- data/gemfiles/sprockets_2.11.gemfile +1 -1
- data/gemfiles/sprockets_2.2.gemfile +1 -1
- data/gemfiles/sprockets_2.3.gemfile +1 -1
- data/gemfiles/sprockets_2.4.gemfile +1 -1
- data/gemfiles/sprockets_2.5.gemfile +1 -1
- data/gemfiles/sprockets_2.6.gemfile +1 -1
- data/gemfiles/sprockets_2.7.gemfile +1 -1
- data/gemfiles/sprockets_2.8.gemfile +1 -1
- data/gemfiles/sprockets_2.9.gemfile +1 -1
- data/gemfiles/sprockets_3.7.gemfile +9 -0
- data/gemfiles/sprockets_4.0.gemfile +10 -0
- data/gemfiles/sprockets_4.0_beta2.gemfile +9 -0
- data/lib/sprockets-sass.rb +1 -0
- data/lib/sprockets/sass.rb +37 -12
- data/lib/sprockets/sass/functions.rb +24 -159
- data/lib/sprockets/sass/registration.rb +126 -0
- data/lib/sprockets/sass/utils.rb +115 -0
- data/lib/sprockets/sass/v2/cache_store.rb +26 -0
- data/lib/sprockets/sass/v2/compressor.rb +31 -0
- data/lib/sprockets/sass/v2/functions.rb +142 -0
- data/lib/sprockets/sass/v2/importer.rb +209 -0
- data/lib/sprockets/sass/v2/sass_template.rb +221 -0
- data/lib/sprockets/sass/v2/scss_template.rb +14 -0
- data/lib/sprockets/sass/v3/cache_store.rb +28 -0
- data/lib/sprockets/sass/v3/compressor.rb +97 -0
- data/lib/sprockets/sass/v3/functions.rb +12 -0
- data/lib/sprockets/sass/v3/importer.rb +212 -0
- data/lib/sprockets/sass/v3/sass_template.rb +37 -0
- data/lib/sprockets/sass/v3/scss_template.rb +15 -0
- data/lib/sprockets/sass/v4/cache_store.rb +11 -0
- data/lib/sprockets/sass/v4/compressor.rb +11 -0
- data/lib/sprockets/sass/v4/functions.rb +12 -0
- data/lib/sprockets/sass/v4/importer.rb +105 -0
- data/lib/sprockets/sass/v4/sass_template.rb +27 -0
- data/lib/sprockets/sass/v4/scss_template.rb +16 -0
- data/lib/sprockets/sass/version.rb +2 -1
- data/spec/custom_importer_spec.rb +4 -6
- data/spec/spec_helper.rb +30 -3
- data/spec/sprockets-sass_spec.rb +101 -61
- data/spec/support/be_fresh_matcher.rb +10 -6
- data/spec/support/dummy_importer.rb +1 -1
- data/spec/support/fail_postprocessor.rb +23 -0
- data/spec/support/sass_template.rb +11 -0
- data/sprockets-sass.gemspec +27 -8
- metadata +92 -95
- data/gemfiles/compass_0.12.gemfile +0 -7
- data/gemfiles/sass_3.2.gemfile +0 -7
- data/gemfiles/sprockets_2.0.gemfile +0 -7
- data/gemfiles/sprockets_2.1.gemfile +0 -9
- data/lib/sprockets/sass/cache_store.rb +0 -27
- data/lib/sprockets/sass/compressor.rb +0 -22
- data/lib/sprockets/sass/importer.rb +0 -142
- data/lib/sprockets/sass/sass_template.rb +0 -115
- data/lib/sprockets/sass/scss_template.rb +0 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9af094799e7e501a8bd0e4d69f7a7fd79e2f3056
|
4
|
+
data.tar.gz: d889b5fba8d6296978821c0c12aa8b063f8a4324
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 759bf41724fa6f5a2cafe99eb39ce7f0f15a820dce7cf1979589ecf13c93e245597a9c93cbb98602beba937da69463bed6441ef7eec20d0a70dce4e46ed0fd86
|
7
|
+
data.tar.gz: 63fa7d50c5350bfd57ce0e0c2fdba2cf902632a767ed950a541e71ee7c82249abee870d7fe7a94a0724bd11608cf7be4ea30f87ac5e38ec875bb9045c186cf64
|
data/.reek
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- sprockets-sass.gemspec
|
4
|
+
- lib/sprockets/sass.rb
|
5
|
+
- bin/**/*
|
6
|
+
- Guardfile
|
7
|
+
- vendor/**/**
|
8
|
+
- spec/**/*
|
9
|
+
- Gemfile
|
10
|
+
- Rakefile
|
11
|
+
|
12
|
+
TargetRubyVersion: 2.3
|
13
|
+
|
14
|
+
ClassLength:
|
15
|
+
Max: 500
|
16
|
+
|
17
|
+
Documentation:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
Encoding:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
LineLength:
|
24
|
+
Max: 200
|
25
|
+
|
26
|
+
AccessModifierIndentation:
|
27
|
+
EnforcedStyle: outdent
|
28
|
+
|
29
|
+
IfUnlessModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
CaseIndentation:
|
33
|
+
IndentWhenRelativeTo: case
|
34
|
+
IndentOneStep: true
|
35
|
+
|
36
|
+
MethodLength:
|
37
|
+
CountComments: false
|
38
|
+
Max: 20
|
39
|
+
|
40
|
+
SignalException:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
ColonMethodCall:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
AsciiComments:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
RegexpLiteral:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
AssignmentInCondition:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
ParameterLists:
|
56
|
+
CountKeywordArgs: false
|
57
|
+
|
58
|
+
SingleLineBlockParams:
|
59
|
+
Methods:
|
60
|
+
- reduce:
|
61
|
+
- memo
|
62
|
+
- item
|
63
|
+
|
64
|
+
Metrics/AbcSize:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Style/CollectionMethods:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Style/SymbolArray:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Style/ExtraSpacing:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Style/FileName:
|
77
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
sudo: false
|
2
|
+
cache: bundler
|
3
|
+
language: ruby
|
4
|
+
before_install:
|
5
|
+
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
6
|
+
- gem install bundler
|
7
|
+
rvm:
|
8
|
+
- 2.0.0
|
9
|
+
- 2.1.5
|
10
|
+
- 2.2.2
|
11
|
+
- 2.2.3
|
12
|
+
- 2.3.1
|
13
|
+
env:
|
14
|
+
- RAILS_ENV=test RACK_ENV=test
|
15
|
+
notifications:
|
16
|
+
email: false
|
data/Appraisals
CHANGED
@@ -1,18 +1,3 @@
|
|
1
|
-
appraise 'sass_3.1' do
|
2
|
-
gem 'sass', '~> 3.1.0'
|
3
|
-
gem 'compass', '~> 0.12.0'
|
4
|
-
end
|
5
|
-
|
6
|
-
appraise 'compass_0.11' do
|
7
|
-
gem 'sass', '~> 3.2.0'
|
8
|
-
gem 'compass', '~> 0.11.0'
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise 'sprockets_2.1' do
|
12
|
-
gem 'sprockets', '~> 2.1.0'
|
13
|
-
gem 'sass', '~> 3.2.0'
|
14
|
-
gem 'compass', '~> 0.12.0'
|
15
|
-
end
|
16
1
|
|
17
2
|
appraise 'sprockets_2.2' do
|
18
3
|
gem 'sprockets', '~> 2.2.0'
|
@@ -73,3 +58,35 @@ appraise 'sprockets_2.11' do
|
|
73
58
|
gem 'sass', '~> 3.2.0'
|
74
59
|
gem 'compass', '~> 0.12.0'
|
75
60
|
end
|
61
|
+
|
62
|
+
appraise 'sprockets_3.7' do
|
63
|
+
gem 'sprockets', '~> 3.7.0'
|
64
|
+
gem 'sass', '~> 3.4.0'
|
65
|
+
gem 'compass', '~> 1.0.0'
|
66
|
+
end
|
67
|
+
|
68
|
+
appraise 'sass_3.1' do
|
69
|
+
gem 'sass', '~> 3.1.0'
|
70
|
+
gem 'compass', '~> 0.12.0'
|
71
|
+
end
|
72
|
+
|
73
|
+
appraise 'sass_3.3' do
|
74
|
+
gem 'sass', '~> 3.3.0'
|
75
|
+
gem 'compass', '~> 1.0.0'
|
76
|
+
end
|
77
|
+
|
78
|
+
appraise 'sass_3.4' do
|
79
|
+
gem 'sass', '~> 3.4.0'
|
80
|
+
gem 'compass', '~> 1.0.0'
|
81
|
+
end
|
82
|
+
|
83
|
+
appraise 'compass_0.11' do
|
84
|
+
gem 'sass', '~> 3.2.0'
|
85
|
+
gem 'compass', '~> 0.11.0'
|
86
|
+
end
|
87
|
+
|
88
|
+
# appraise 'sprockets_4.0_beta2' do
|
89
|
+
# gem 'sprockets', '4.0.0.beta2'
|
90
|
+
# gem 'sass', '~> 3.4.0'
|
91
|
+
# gem 'compass', '~> 1.0.0'
|
92
|
+
# end
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
sprockets-sass
|
2
2
|
==============
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/sprockets-sass.svg)](https://badge.fury.io/rb/sprockets-sass) [![Build Status](https://travis-ci.org/petebrowne/sprockets-sass.svg?branch=master)](https://travis-ci.org/petebrowne/sprockets-sass)
|
5
|
+
|
4
6
|
**Better Sass integration with [Sprockets 2.x](http://github.com/sstephenson/sprockets)**
|
5
7
|
|
6
8
|
When using Sprockets 2.x with Sass you will eventually run into a pretty big issue. `//= require` directives will not allow Sass mixins, variables, etc. to be shared between files. So you'll try to use `@import`, and that'll also blow up in your face. `sprockets-sass` fixes all of this by creating a Sass::Importer that is Sprockets aware.
|
7
9
|
|
8
|
-
|
10
|
+
**Note: This works in Rails 3.1, thanks to the [sass-rails gem](http://github.com/rails/sass-rails). But if you want to use Sprockets and Sass anywhere else, like Sinatra, use `sprockets-sass`**
|
9
11
|
|
10
12
|
### Features
|
11
13
|
|
12
|
-
* Imports Sass _partials_ (filenames prepended with
|
14
|
+
* Imports Sass ```_partials_``` (filenames prepended with ```_```).
|
13
15
|
* Import paths work exactly like `require` directives.
|
14
16
|
* Imports either Sass syntax, or just regular CSS files.
|
15
17
|
* Imported files are preprocessed by Sprockets, so `.css.scss.erb` files can be imported.
|
@@ -48,6 +50,24 @@ map "/" do
|
|
48
50
|
end
|
49
51
|
```
|
50
52
|
|
53
|
+
Sprockets Sass provides also a compressor for ```.css``` files
|
54
|
+
|
55
|
+
You can use it with Sprockets 2.x by doing this:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
environment = Sprockets::Environment.new
|
59
|
+
environment.css_compressor = Sprockets::Sass::V2::Compressor
|
60
|
+
```
|
61
|
+
|
62
|
+
Or with Sprockets 3.x by doing this:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
environment = Sprockets::Environment.new
|
66
|
+
environment.css_compressor = :sprockets_sass
|
67
|
+
```
|
68
|
+
|
69
|
+
Or with Rails by setting ```css_compressor``` in the ```config/application.rb``` file to one of the values listed above depending on your version of Sprockets
|
70
|
+
|
51
71
|
Now `@import` works essentially just like a `require` directive, but with one essential bonus:
|
52
72
|
Sass mixins, variables, etc. work as expected.
|
53
73
|
|
@@ -158,13 +178,13 @@ require "sass"
|
|
158
178
|
map "/assets" do
|
159
179
|
environment = Sprockets::Environment.new
|
160
180
|
environment.append_path "assets/stylesheets"
|
161
|
-
|
181
|
+
|
162
182
|
Sprockets::Helpers.configure do |config|
|
163
183
|
config.environment = environment
|
164
184
|
config.prefix = "/assets"
|
165
185
|
config.digest = false
|
166
186
|
end
|
167
|
-
|
187
|
+
|
168
188
|
run environment
|
169
189
|
end
|
170
190
|
|
@@ -192,6 +212,23 @@ background: asset-data-uri("image.jpg"); // background: url(data:image/jpeg;base
|
|
192
212
|
```
|
193
213
|
|
194
214
|
|
215
|
+
Development
|
216
|
+
-----------
|
217
|
+
|
218
|
+
Install dependencies using bundler:
|
219
|
+
|
220
|
+
``` bash
|
221
|
+
bundle install
|
222
|
+
```
|
223
|
+
|
224
|
+
sprocket-sass is tested against numerous versions of Sass, Compoass, and Sprockets using [appraisal](https://github.com/thoughtbot/appraisal).
|
225
|
+
This will install all the gems and run the tests against all versions
|
226
|
+
Run tests:
|
227
|
+
|
228
|
+
``` bash
|
229
|
+
bundle exec rake
|
230
|
+
```
|
231
|
+
|
195
232
|
Copyright
|
196
233
|
---------
|
197
234
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
-
require '
|
1
|
+
require 'bundler/setup'
|
2
2
|
require 'bundler/gem_tasks'
|
3
|
+
require 'appraisal'
|
3
4
|
require 'rspec/core/rake_task'
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
8
|
+
spec.rspec_opts = ['--backtrace '] if ENV['DEBUG']
|
9
|
+
spec.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Default: run the unit tests.'
|
13
|
+
task default: [:all]
|
14
|
+
|
15
|
+
desc 'Test the plugin under all supported versions.'
|
16
|
+
task :all do |_t|
|
17
|
+
exec('bundle exec appraisal install && bundle exec rake appraisal spec')
|
18
|
+
end
|
data/gemfiles/sass_3.1.gemfile
CHANGED
data/lib/sprockets-sass.rb
CHANGED
data/lib/sprockets/sass.rb
CHANGED
@@ -1,29 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'sprockets'
|
2
3
|
require 'sprockets/sass/version'
|
3
|
-
require 'sprockets/sass/
|
4
|
-
require 'sprockets/sass/
|
5
|
-
require '
|
4
|
+
require 'sprockets/sass/utils'
|
5
|
+
require 'sprockets/sass/registration'
|
6
|
+
require 'sass'
|
7
|
+
require 'sass/importers/base'
|
6
8
|
|
9
|
+
require 'json'
|
10
|
+
require 'pathname'
|
11
|
+
|
12
|
+
|
13
|
+
# the module of Sprockets
|
7
14
|
module Sprockets
|
15
|
+
# The internal Sass module used to load and acessing configuration
|
8
16
|
module Sass
|
9
|
-
autoload :CacheStore, 'sprockets/sass/cache_store'
|
10
|
-
autoload :Compressor, 'sprockets/sass/compressor'
|
11
|
-
autoload :Importer, 'sprockets/sass/importer'
|
12
|
-
|
13
17
|
class << self
|
14
18
|
# Global configuration for `Sass::Engine` instances.
|
15
19
|
attr_accessor :options
|
16
|
-
|
20
|
+
|
17
21
|
# When false, the asset path helpers provided by
|
18
22
|
# sprockets-helpers will not be added as Sass functions.
|
19
23
|
# `true` by default.
|
20
24
|
attr_accessor :add_sass_functions
|
21
25
|
end
|
22
|
-
|
26
|
+
|
23
27
|
@options = {}
|
24
28
|
@add_sass_functions = true
|
25
29
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
|
31
|
+
begin
|
32
|
+
require 'sprockets/directive_processor'
|
33
|
+
require 'sprockets/sass_processor'
|
34
|
+
require 'sprockets/sassc_processor'
|
35
|
+
require 'sprockets/digest_utils'
|
36
|
+
require 'sprockets/engines'
|
37
|
+
rescue LoadError; end
|
38
|
+
|
39
|
+
if Sprockets::Sass::Utils.version_of_sprockets >= 3
|
40
|
+
# We need this only for Sprockets > 3 in order to be able to register anything.
|
41
|
+
# For Sprockets 2.x , although the file and the module name exist,
|
42
|
+
# they can't be used because it will give errors about undefined methods, because this is included only on Sprockets::Base
|
43
|
+
# and in order to use them we would have to subclass it and define methods to expire cache and other methods for registration ,
|
44
|
+
# which are not needed since Sprockets already knows about that using the environment instead internally
|
45
|
+
require 'sprockets/processing'
|
46
|
+
extend Sprockets::Processing
|
47
|
+
end
|
48
|
+
|
49
|
+
registration = Sprockets::Sass::Registration.new(self)
|
50
|
+
registration.run
|
29
51
|
end
|
52
|
+
|
53
|
+
# Sprockets 4 needs this , becasue it doesnt use ::Sass in code, which results in a conflict with this gem :(
|
54
|
+
Sprockets::Sass::Importers = ::Sass::Importers
|