sassc-rails 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -6
- data/CODE_OF_CONDUCT.md +10 -0
- data/README.md +3 -2
- data/Rakefile +2 -4
- data/gemfiles/{rails_4_0.gemfile → rails_5_2.gemfile} +1 -1
- data/gemfiles/sprockets-rails_2_3.gemfile +1 -1
- data/lib/sassc-rails.rb +1 -5
- data/lib/sassc/rails.rb +2 -0
- data/lib/sassc/rails/compressor.rb +13 -0
- data/lib/sassc/rails/functions.rb +2 -0
- data/lib/sassc/rails/importer.rb +5 -0
- data/lib/sassc/rails/railtie.rb +4 -2
- data/lib/sassc/rails/template.rb +58 -69
- data/lib/sassc/rails/version.rb +3 -1
- data/sassc-rails.gemspec +2 -6
- data/test/sassc_rails_test.rb +5 -3
- data/test/test_helper.rb +3 -1
- metadata +10 -26
- data/gemfiles/rails_4_1.gemfile +0 -6
- data/gemfiles/sprockets_2_12.gemfile +0 -6
- data/gemfiles/with_sass_rails.gemfile +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 597d03494d8a7feeff8bae4c0be19c2afe9852a05499afd17ab59010257cdfc2
|
4
|
+
data.tar.gz: 7055195b1511df649ab20ff16e06dd14a385fcd7b44f2c0acf51c844559a457f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 441e0939dd260e0cd05505cdbd38bcf638f65f5eec6ec15588698eaa9b8a354f0776bd89a2596732346e9a40e426fcac4cf3f951c67b742259af3ddd0d70c8bf
|
7
|
+
data.tar.gz: 566ffe365478924633f4ad7ceb2cb0b7739c22040527342727853af18e071189b5ed3b0d50ad80cd07aa4ccefb32bc9bfcf834c84f483a6bcb98925fd6d5db9f
|
data/.travis.yml
CHANGED
@@ -5,17 +5,16 @@ bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
|
|
5
5
|
script: "bundle exec rake test"
|
6
6
|
|
7
7
|
gemfile:
|
8
|
-
- gemfiles/
|
8
|
+
- gemfiles/sprockets-rails_3_0.gemfile
|
9
|
+
- gemfiles/sprockets-rails_2_3.gemfile
|
9
10
|
- gemfiles/sprockets_3_0.gemfile
|
10
11
|
- gemfiles/sprockets_4_0.gemfile
|
11
|
-
- gemfiles/sprockets-rails_3_0.gemfile
|
12
12
|
- gemfiles/rails_4_2.gemfile
|
13
|
-
- gemfiles/
|
14
|
-
- gemfiles/rails_4_0.gemfile
|
13
|
+
- gemfiles/rails_5_2.gemfile
|
15
14
|
|
16
15
|
rvm:
|
17
|
-
- 2.
|
18
|
-
- 2.
|
16
|
+
- 2.4.4
|
17
|
+
- 2.5.1
|
19
18
|
|
20
19
|
notifications:
|
21
20
|
email: false
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Sass is more than a technology; Sass is driven by the community of individuals
|
2
|
+
that power its development and use every day. As a community, we want to embrace
|
3
|
+
the very differences that have made our collaboration so powerful, and work
|
4
|
+
together to provide the best environment for learning, growing, and sharing of
|
5
|
+
ideas. It is imperative that we keep Sass a fun, welcoming, challenging, and
|
6
|
+
fair place to play.
|
7
|
+
|
8
|
+
[The full community guidelines can be found on the Sass website.][link]
|
9
|
+
|
10
|
+
[link]: http://sass-lang.com/community-guidelines
|
data/README.md
CHANGED
@@ -22,8 +22,6 @@ In one larger project, this made compilation 4x faster:
|
|
22
22
|
|
23
23
|
This should essentially be a drop in alternative to [sass-rails](https://github.com/rails/sass-rails).
|
24
24
|
|
25
|
-
__Note: This is a new project, please report any issues you come across!__
|
26
|
-
|
27
25
|
## Inline Source Maps
|
28
26
|
|
29
27
|
With SassC-Rails, it's also extremely easy to turn on inline source maps. Simply
|
@@ -87,6 +85,9 @@ is maintained by [Ryan Boland](https://ryanboland.com) and [awesome contributors
|
|
87
85
|
|
88
86
|
## Changelog
|
89
87
|
|
88
|
+
- **2.0.0**
|
89
|
+
- [Drop support for Sprockets 2](https://github.com/sass/sassc-rails/pull/109)
|
90
|
+
- [Remove dependency on Ruby Sass](https://github.com/sass/sassc-rails/pull/109)
|
90
91
|
- **1.3.0**
|
91
92
|
- [Silence Sprockets deprecation warnings](https://github.com/sass/sassc-rails/pull/76)
|
92
93
|
- [Sprockets 4 compatibility](https://github.com/sass/sassc-rails/pull/65)
|
data/Rakefile
CHANGED
@@ -10,12 +10,10 @@ namespace :tests do
|
|
10
10
|
gemfiles = %w[
|
11
11
|
sprockets-rails_3_0
|
12
12
|
sprockets-rails_2_3
|
13
|
-
sprockets_2_12
|
14
13
|
sprockets_3_0
|
14
|
+
sprockets_4_0
|
15
15
|
rails_4_2
|
16
|
-
|
17
|
-
rails_4_0
|
18
|
-
with_sass_rails
|
16
|
+
rails_5_2
|
19
17
|
]
|
20
18
|
|
21
19
|
gemfiles.each do |gemfile|
|
data/lib/sassc-rails.rb
CHANGED
data/lib/sassc/rails.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'sprockets/sass_compressor'
|
4
|
+
require 'securerandom'
|
2
5
|
|
3
6
|
class Sprockets::SassCompressor
|
7
|
+
def initialize(options = {})
|
8
|
+
@options = {
|
9
|
+
syntax: :scss,
|
10
|
+
cache: false,
|
11
|
+
read_cache: false,
|
12
|
+
style: :compressed
|
13
|
+
}.merge(options).freeze
|
14
|
+
@cache_key = SecureRandom.uuid
|
15
|
+
end
|
16
|
+
|
4
17
|
def call(*args)
|
5
18
|
input = if defined?(data)
|
6
19
|
data # sprockets 2.x
|
data/lib/sassc/rails/importer.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'tilt'
|
2
4
|
|
3
5
|
module SassC
|
@@ -100,6 +102,9 @@ module SassC
|
|
100
102
|
search_paths.map! do |path|
|
101
103
|
File.join(path, specified_dir)
|
102
104
|
end
|
105
|
+
search_paths.select! do |path|
|
106
|
+
File.directory?(path)
|
107
|
+
end
|
103
108
|
end
|
104
109
|
|
105
110
|
search_paths.each do |search_path|
|
data/lib/sassc/rails/railtie.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/core_ext/class/attribute'
|
2
4
|
require 'sprockets/railtie'
|
3
5
|
|
@@ -51,8 +53,8 @@ module SassC::Rails
|
|
51
53
|
end
|
52
54
|
|
53
55
|
if env.respond_to?(:register_transformer)
|
54
|
-
env.register_transformer 'text/sass', 'text/css', SassC::Rails::SassTemplate.new
|
55
|
-
env.register_transformer 'text/scss', 'text/css', SassC::Rails::ScssTemplate.new
|
56
|
+
env.register_transformer 'text/sass', 'text/css', SassC::Rails::SassTemplate.new
|
57
|
+
env.register_transformer 'text/scss', 'text/css', SassC::Rails::ScssTemplate.new
|
56
58
|
end
|
57
59
|
|
58
60
|
if env.respond_to?(:register_engine)
|
data/lib/sassc/rails/template.rb
CHANGED
@@ -1,71 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'sprockets/sass_processor'
|
5
|
-
rescue LoadError
|
6
|
-
require "sprockets/sass_template"
|
7
|
-
end
|
1
|
+
# frozen_string_literal: true
|
8
2
|
|
3
|
+
require "sprockets/version"
|
4
|
+
require 'sprockets/sass_processor'
|
9
5
|
require "sprockets/utils"
|
10
6
|
|
11
7
|
module SassC::Rails
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
load_paths: input[:environment].paths,
|
23
|
-
importer: SassC::Rails::Importer,
|
24
|
-
sprockets: {
|
25
|
-
context: context,
|
26
|
-
environment: input[:environment],
|
27
|
-
dependencies: context.metadata[:dependency_paths]
|
28
|
-
}
|
29
|
-
}.merge(config_options) { |*args| safe_merge(*args) }
|
30
|
-
|
31
|
-
engine = ::SassC::Engine.new(input[:data], options)
|
32
|
-
|
33
|
-
css = Sprockets::Utils.module_include(::SassC::Script::Functions, @functions) do
|
34
|
-
engine.render
|
35
|
-
end
|
36
|
-
|
37
|
-
context.metadata.merge(data: css)
|
8
|
+
class SassTemplate < Sprockets::SassProcessor
|
9
|
+
def initialize(options = {}, &block)
|
10
|
+
@cache_version = options[:cache_version]
|
11
|
+
@cache_key = "#{self.class.name}:#{VERSION}:#{SassC::VERSION}:#{@cache_version}".freeze
|
12
|
+
#@importer_class = options[:importer] || Sass::Importers::Filesystem
|
13
|
+
@sass_config = options[:sass_config] || {}
|
14
|
+
@functions = Module.new do
|
15
|
+
include Functions
|
16
|
+
include options[:functions] if options[:functions]
|
17
|
+
class_eval(&block) if block_given?
|
38
18
|
end
|
39
19
|
end
|
40
20
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
21
|
+
def call(input)
|
22
|
+
context = input[:environment].context_class.new(input)
|
23
|
+
|
24
|
+
options = {
|
25
|
+
filename: input[:filename],
|
26
|
+
line_comments: line_comments?,
|
27
|
+
syntax: self.class.syntax,
|
28
|
+
load_paths: input[:environment].paths,
|
29
|
+
importer: SassC::Rails::Importer,
|
30
|
+
sprockets: {
|
31
|
+
context: context,
|
32
|
+
environment: input[:environment],
|
33
|
+
dependencies: context.metadata[:dependency_paths]
|
34
|
+
}
|
35
|
+
}.merge(config_options) { |*args| safe_merge(*args) }
|
36
|
+
|
37
|
+
engine = ::SassC::Engine.new(input[:data], options)
|
38
|
+
|
39
|
+
css = Sprockets::Utils.module_include(::SassC::Script::Functions, @functions) do
|
40
|
+
engine.render
|
46
41
|
end
|
47
42
|
|
48
|
-
|
49
|
-
options = {
|
50
|
-
filename: eval_file,
|
51
|
-
line_comments: line_comments?,
|
52
|
-
syntax: syntax,
|
53
|
-
load_paths: context.environment.paths,
|
54
|
-
importer: SassC::Rails::Importer,
|
55
|
-
sprockets: {
|
56
|
-
context: context,
|
57
|
-
environment: context.environment
|
58
|
-
}
|
59
|
-
}.merge(config_options, &method(:safe_merge))
|
60
|
-
|
61
|
-
::SassC::Engine.new(data, options).render
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
if Sprockets::VERSION > "3.0.0"
|
66
|
-
include Sprockets3
|
67
|
-
else
|
68
|
-
include Sprockets2
|
43
|
+
context.metadata.merge(data: css)
|
69
44
|
end
|
70
45
|
|
71
46
|
def config_options
|
@@ -104,20 +79,34 @@ module SassC::Rails
|
|
104
79
|
right
|
105
80
|
end
|
106
81
|
end
|
107
|
-
end
|
108
82
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
83
|
+
# The methods in the Functions module were copied here from sprockets in order to
|
84
|
+
# override the Value class names (e.g. ::SassC::Script::Value::String)
|
85
|
+
module Functions
|
86
|
+
def asset_path(path, options = {})
|
87
|
+
path = path.value
|
113
88
|
|
114
|
-
|
115
|
-
|
116
|
-
|
89
|
+
path, _, query, fragment = URI.split(path)[5..8]
|
90
|
+
path = sprockets_context.asset_path(path, options)
|
91
|
+
query = "?#{query}" if query
|
92
|
+
fragment = "##{fragment}" if fragment
|
93
|
+
|
94
|
+
::SassC::Script::Value::String.new("#{path}#{query}#{fragment}", :string)
|
95
|
+
end
|
96
|
+
|
97
|
+
def asset_url(path, options = {})
|
98
|
+
::SassC::Script::Value::String.new("url(#{asset_path(path, options).value})")
|
99
|
+
end
|
100
|
+
|
101
|
+
def asset_data_url(path)
|
102
|
+
url = sprockets_context.asset_data_uri(path.value)
|
103
|
+
::SassC::Script::Value::String.new("url(" + url + ")")
|
104
|
+
end
|
117
105
|
end
|
106
|
+
end
|
118
107
|
|
119
|
-
|
120
|
-
def syntax
|
108
|
+
class ScssTemplate < SassTemplate
|
109
|
+
def self.syntax
|
121
110
|
:scss
|
122
111
|
end
|
123
112
|
end
|
data/lib/sassc/rails/version.rb
CHANGED
data/sassc-rails.gemspec
CHANGED
@@ -23,14 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency 'mocha'
|
25
25
|
|
26
|
-
|
27
|
-
# reuse portions of the Sprockets template
|
28
|
-
spec.add_dependency 'sass'
|
29
|
-
spec.add_dependency "sassc", "~> 1.9"
|
30
|
-
|
26
|
+
spec.add_dependency "sassc", ">= 2.0"
|
31
27
|
spec.add_dependency "tilt"
|
32
28
|
|
33
29
|
spec.add_dependency 'railties', '>= 4.0.0'
|
34
|
-
spec.add_dependency 'sprockets', '>
|
30
|
+
spec.add_dependency 'sprockets', '> 3.0'
|
35
31
|
spec.add_dependency 'sprockets-rails'
|
36
32
|
end
|
data/test/sassc_rails_test.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_helper"
|
2
4
|
|
3
|
-
class SassRailsTest < MiniTest::
|
5
|
+
class SassRailsTest < MiniTest::Test
|
4
6
|
attr_reader :app
|
5
7
|
|
6
8
|
def setup
|
@@ -167,7 +169,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
167
169
|
|
168
170
|
css_output = render_asset("css_scss_handler.css")
|
169
171
|
assert_match %r{/* line 1}, css_output
|
170
|
-
assert_match %r{
|
172
|
+
assert_match %r{.+test/dummy/app/assets/stylesheets/css_scss_handler.css.scss}, css_output
|
171
173
|
end
|
172
174
|
|
173
175
|
def test_context_is_being_passed_to_erb_render
|
@@ -191,7 +193,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
191
193
|
def test_css_compressor_config_item_may_be_nil_in_test_mode
|
192
194
|
@app.config.assets.css_compressor = nil
|
193
195
|
initialize!
|
194
|
-
|
196
|
+
assert_nil Rails.application.config.assets.css_compressor
|
195
197
|
end
|
196
198
|
|
197
199
|
def test_css_compressor_is_defined_in_test_mode
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
ENV["RAILS_ENV"] = "test"
|
2
4
|
|
3
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
@@ -8,7 +10,7 @@ require "fileutils"
|
|
8
10
|
require 'rails'
|
9
11
|
require 'bundler/setup'
|
10
12
|
require "minitest/autorun"
|
11
|
-
require 'mocha/
|
13
|
+
require 'mocha/minitest'
|
12
14
|
|
13
15
|
Bundler.require
|
14
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -67,33 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: sassc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '2.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: sassc
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.9'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.9'
|
82
|
+
version: '2.0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: tilt
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +114,14 @@ dependencies:
|
|
128
114
|
requirements:
|
129
115
|
- - ">"
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
117
|
+
version: '3.0'
|
132
118
|
type: :runtime
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
122
|
- - ">"
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
124
|
+
version: '3.0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: sprockets-rails
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,19 +145,17 @@ extra_rdoc_files: []
|
|
159
145
|
files:
|
160
146
|
- ".gitignore"
|
161
147
|
- ".travis.yml"
|
148
|
+
- CODE_OF_CONDUCT.md
|
162
149
|
- Gemfile
|
163
150
|
- LICENSE.txt
|
164
151
|
- README.md
|
165
152
|
- Rakefile
|
166
|
-
- gemfiles/rails_4_0.gemfile
|
167
|
-
- gemfiles/rails_4_1.gemfile
|
168
153
|
- gemfiles/rails_4_2.gemfile
|
154
|
+
- gemfiles/rails_5_2.gemfile
|
169
155
|
- gemfiles/sprockets-rails_2_3.gemfile
|
170
156
|
- gemfiles/sprockets-rails_3_0.gemfile
|
171
|
-
- gemfiles/sprockets_2_12.gemfile
|
172
157
|
- gemfiles/sprockets_3_0.gemfile
|
173
158
|
- gemfiles/sprockets_4_0.gemfile
|
174
|
-
- gemfiles/with_sass_rails.gemfile
|
175
159
|
- lib/sassc-rails.rb
|
176
160
|
- lib/sassc/rails.rb
|
177
161
|
- lib/sassc/rails/compressor.rb
|
@@ -239,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
223
|
version: '0'
|
240
224
|
requirements: []
|
241
225
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.7.6
|
243
227
|
signing_key:
|
244
228
|
specification_version: 4
|
245
229
|
summary: Integrate SassC-Ruby into Rails.
|
data/gemfiles/rails_4_1.gemfile
DELETED