sassc-rails 1.3.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d64addcb28c15b04b17828fcb483f865e31f5807
4
- data.tar.gz: 89b980dbf7276dc1ba6e3d5b547b74be35537a7b
2
+ SHA256:
3
+ metadata.gz: 597d03494d8a7feeff8bae4c0be19c2afe9852a05499afd17ab59010257cdfc2
4
+ data.tar.gz: 7055195b1511df649ab20ff16e06dd14a385fcd7b44f2c0acf51c844559a457f
5
5
  SHA512:
6
- metadata.gz: 680cfb7d2a6144a63e3fc94baf65d6ebc15eb6d3c0fa5f65ce995606016b69e685a371c255e7f22830127c3796abed7993f8cb52da1c27b62b0b1714df0aaaf9
7
- data.tar.gz: 98e2152e6aef09bfb9b7291779f80f02a441f5f6c4835e71780d16d2c6b580731be8c423154ea6c3d4400329aee35bf2023a07b5775e2b654548494b86cd6ac4
6
+ metadata.gz: 441e0939dd260e0cd05505cdbd38bcf638f65f5eec6ec15588698eaa9b8a354f0776bd89a2596732346e9a40e426fcac4cf3f951c67b742259af3ddd0d70c8bf
7
+ data.tar.gz: 566ffe365478924633f4ad7ceb2cb0b7739c22040527342727853af18e071189b5ed3b0d50ad80cd07aa4ccefb32bc9bfcf834c84f483a6bcb98925fd6d5db9f
@@ -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/sprockets_2_12.gemfile
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/rails_4_1.gemfile
14
- - gemfiles/rails_4_0.gemfile
13
+ - gemfiles/rails_5_2.gemfile
15
14
 
16
15
  rvm:
17
- - 2.2.2
18
- - 2.3.0
16
+ - 2.4.4
17
+ - 2.5.1
19
18
 
20
19
  notifications:
21
20
  email: false
@@ -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
- rails_4_1
17
- rails_4_0
18
- with_sass_rails
16
+ rails_5_2
19
17
  ]
20
18
 
21
19
  gemfiles.each do |gemfile|
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "rails", "~> 4.0.0"
3
+ gem "rails", "~> 5.2.1"
4
4
 
5
5
  # Specify your gem's dependencies in sassc-rails.gemspec
6
6
  gemspec path: "../"
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "sprockets-rails", "~> 2.3.0"
3
+ gem "sprockets-rails", "~> 2.3.3"
4
4
 
5
5
  # Specify your gem's dependencies in sassc-rails.gemspec
6
6
  gemspec path: "../"
@@ -1,8 +1,4 @@
1
- begin
2
- require "sass-rails"
3
- Rails::Railtie.subclasses.delete Sass::Rails::Railtie
4
- rescue LoadError
5
- end
1
+ # frozen_string_literal: true
6
2
 
7
3
  require_relative "sassc/rails"
8
4
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "rails/version"
2
4
 
3
5
  require "sassc"
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sprockets/sass_functions'
2
4
 
3
5
  module Sprockets
@@ -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|
@@ -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 #->() { puts "yoyoyoy" }
55
- env.register_transformer 'text/scss', 'text/css', SassC::Rails::ScssTemplate.new #->() { puts "yoyoyoy" }
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)
@@ -1,71 +1,46 @@
1
- require "sprockets/version"
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
- class SassTemplate < defined?(Sprockets::SassProcessor) ? Sprockets::SassProcessor : Sprockets::SassTemplate
14
- module Sprockets3
15
- def call(input)
16
- context = input[:environment].context_class.new(input)
17
-
18
- options = {
19
- filename: input[:filename],
20
- line_comments: line_comments?,
21
- syntax: self.class.syntax,
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
- module Sprockets2
42
- def self.included(base)
43
- base.class_eval do
44
- self.default_mime_type = "text/css"
45
- end
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
- def evaluate(context, locals, &block)
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
- class ScssTemplate < SassTemplate
110
- unless Sprockets::VERSION > "3.0.0"
111
- self.default_mime_type = 'text/css'
112
- end
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
- # Sprockets 3
115
- def self.syntax
116
- :scss
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
- # Sprockets 2
120
- def syntax
108
+ class ScssTemplate < SassTemplate
109
+ def self.syntax
121
110
  :scss
122
111
  end
123
112
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SassC
2
4
  module Rails
3
- VERSION = "1.3.0"
5
+ VERSION = "2.0.0"
4
6
  end
5
7
  end
@@ -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
- # Unfortunately we require sass for now, so that we can
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', '> 2.11'
30
+ spec.add_dependency 'sprockets', '> 3.0'
35
31
  spec.add_dependency 'sprockets-rails'
36
32
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
- class SassRailsTest < MiniTest::Unit::TestCase
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{.+/sassc-rails/test/dummy/app/assets/stylesheets/css_scss_handler.css.scss}, css_output
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
- assert_equal nil, Rails.application.config.assets.css_compressor
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
@@ -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/mini_test'
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: 1.3.0
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: 2016-08-10 00:00:00.000000000 Z
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: sass
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: '2.11'
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: '2.11'
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.5.1
226
+ rubygems_version: 2.7.6
243
227
  signing_key:
244
228
  specification_version: 4
245
229
  summary: Integrate SassC-Ruby into Rails.
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "rails", "~> 4.1.0"
4
-
5
- # Specify your gem's dependencies in sassc-rails.gemspec
6
- gemspec path: "../"
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "sprockets", "~> 2.12.0"
4
-
5
- # Specify your gem's dependencies in sassc-rails.gemspec
6
- gemspec path: "../"
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "sass-rails"
4
-
5
- # Specify your gem's dependencies in sassc-rails.gemspec
6
- gemspec path: "../"