hanami-assets 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3eca9645ece86fd7d459f856d4bd5927218a0bf2793800d79893f182802b3e8
4
- data.tar.gz: ce397508bfee8960426520195c3a9916f782e816add006c936d53a36fccb6c56
3
+ metadata.gz: 72e4862475bc1ff37c766b05a9a08bb3ce9da8a2cf10aed7d01299cbe7178025
4
+ data.tar.gz: 99ee3de7d08606a05597e10ad263f22366190b428ff9901155d67493af8c3bcf
5
5
  SHA512:
6
- metadata.gz: 8e0993d7081bdb900809b102654b2cd808a020e8e210c4e54b475b1d89f13c500f0ae636622972f737c342671715a0e4067f9c508f92e9fbf1e953b045d18852
7
- data.tar.gz: ad68fce253795abe8b209d694205db4c239ede2cc9c6553126e2a214093ed0f76dd20dd480a114ebfdaa77a0fc4e76dbed445ee78bba748ff85a25875df7cbed
6
+ metadata.gz: 0b640e6812aa38cd807fddb0c2a0319d667acfd431cb60f15176a3c62cfbd96c1e1962a9f57032b11d663bd694f3e8bb71d4c3ca393ebaaf0f2ca3c81b83d44b
7
+ data.tar.gz: f83efc99e3720db13b6d7fc621022c38e719734fff57fd304dbcf93b950c3bc1920753bab902d18088974f5397ba7b03a5cca0c990981f2cc2d1b29ddd56c7f9
@@ -1,6 +1,10 @@
1
1
  # Hanami::Assets
2
2
  Assets management for Ruby web applications
3
3
 
4
+ ## v1.3.2 - 2019-08-02
5
+ ### Added
6
+ - [Landon Grindheim & Sean Collins] Added support for `sassc` gem, because `sass` is no longer maintained
7
+
4
8
  ## v1.3.1 - 2019-01-18
5
9
  ### Added
6
10
  - [Luca Guidi] Official support for Ruby: MRI 2.6
data/README.md CHANGED
@@ -15,7 +15,7 @@ Assets management for Ruby web projects
15
15
 
16
16
  * Home page: http://hanamirb.org
17
17
  * Community: http://hanamirb.org/community
18
- * Guides: http://hanamirb.org/guides
18
+ * Guides: https://guides.hanamirb.org
19
19
  * Mailing List: http://hanamirb.org/mailing-list
20
20
  * API Doc: http://rdoc.info/gems/hanami-assets
21
21
  * Bugs/Issues: https://github.com/hanami/assets/issues
@@ -200,7 +200,7 @@ handling: `.css` for stylesheets.
200
200
  The second one is optional and it's for a preprocessor: `.scss` for Sass.
201
201
 
202
202
  ```ruby
203
- require 'sass'
203
+ require 'sassc'
204
204
  require 'hanami/assets'
205
205
 
206
206
  Hanami::Assets.configure do
@@ -353,7 +353,7 @@ Hanami can use the following compressors (aka minifiers) for stylesheets.
353
353
 
354
354
  * `:builtin` - Ruby based compressor. It doesn't require any external gem. It's fast, but not an efficient compressor.
355
355
  * `:yui` - [YUI Compressor](http://yui.github.io/yuicompressor), it depends on [`yui-compressor`](https://rubygems.org/gems/yui-compressor) gem and it requires Java 1.4+
356
- * `:sass` - [Sass](http://sass-lang.com/), it depends on [`sass`](https://rubygems.org/gems/sass) gem
356
+ * `:sass` - [Sass](http://sass-lang.com/), it depends on [`sassc`](https://rubygems.org/gems/sassc) gem
357
357
 
358
358
  ```ruby
359
359
  Hanami::Assets.configure do
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'yui-compressor', '~> 0.12'
32
32
  spec.add_development_dependency 'uglifier', '~> 2.7'
33
33
  spec.add_development_dependency 'closure-compiler', '~> 1.1'
34
- spec.add_development_dependency 'sass', '~> 3.4'
34
+ spec.add_development_dependency 'sassc', '~> 2.0'
35
35
 
36
36
  spec.add_development_dependency 'coffee-script', '~> 2.3'
37
37
  spec.add_development_dependency 'babel-transpiler', '~> 0.7'
@@ -46,12 +46,12 @@ module Hanami
46
46
  # @api private
47
47
  def _compress(compressor)
48
48
  compressor.compress(@path)
49
- rescue => e # rubocop:disable Style/RescueStandardError
49
+ rescue => exception # rubocop:disable Style/RescueStandardError
50
50
  warn(
51
51
  [
52
52
  "Skipping compression of: `#{@path}'",
53
- "Reason: #{e}\n",
54
- "\t#{e.backtrace.join("\n\t")}\n\n"
53
+ "Reason: #{exception}\n",
54
+ "\t#{exception.backtrace.join("\n\t")}\n\n"
55
55
  ].join("\n")
56
56
  )
57
57
  end
@@ -10,11 +10,6 @@ module Hanami
10
10
  # @api private
11
11
  EXTENSIONS = /\.(sass|scss)\z/.freeze
12
12
 
13
- # @since 0.1.0
14
- # @api private
15
- CACHE_LOCATION = Pathname(Hanami.respond_to?(:root) ? # rubocop:disable Style/MultilineTernaryOperator
16
- Hanami.root : Dir.pwd).join('tmp', 'sass-cache')
17
-
18
13
  # @since 0.3.0
19
14
  # @api private
20
15
  def self.eligible?(name)
@@ -26,19 +21,28 @@ module Hanami
26
21
  # @since 0.3.0
27
22
  # @api private
28
23
  def renderer
29
- Tilt.new(source, nil, load_paths: load_paths, cache_location: CACHE_LOCATION)
24
+ @renderer ||=
25
+ ::SassC::Engine.new(
26
+ source.read,
27
+ syntax: target_syntax,
28
+ load_paths: load_paths
29
+ )
30
30
  end
31
31
 
32
32
  # @since 0.3.0
33
33
  # @api private
34
34
  def dependencies
35
- engine.dependencies.map { |d| d.options[:filename] }
35
+ renderer.dependencies.map(&:filename)
36
36
  end
37
37
 
38
- # @since 0.3.0
38
+ # @since 1.3.2
39
39
  # @api private
40
- def engine
41
- ::Sass::Engine.for_file(source.to_s, load_paths: load_paths, cache_location: CACHE_LOCATION)
40
+ def target_syntax
41
+ if source.extname =~ /sass\z/.freeze
42
+ :sass
43
+ else
44
+ :scss
45
+ end
42
46
  end
43
47
  end
44
48
  end
@@ -1,12 +1,12 @@
1
1
  require 'hanami/assets/compressors/stylesheet'
2
- require 'sass'
2
+ require 'sassc'
3
3
 
4
4
  module Hanami
5
5
  module Assets
6
6
  module Compressors
7
7
  # Sass compressor for stylesheet
8
8
  #
9
- # It depends on <tt>sass</tt> gem.
9
+ # It depends on <tt>sassc</tt> gem.
10
10
  #
11
11
  # @since 0.1.0
12
12
  # @api private
@@ -16,21 +16,19 @@ module Hanami
16
16
  class SassStylesheet < Stylesheet
17
17
  # @since 0.1.0
18
18
  # @api private
19
- #
20
- # FIXME This is the same logic that we have for Hanami::Assets::Compiler
21
- SASS_CACHE_LOCATION = Pathname(Hanami.respond_to?(:root) ? # rubocop:disable Style/MultilineTernaryOperator
22
- Hanami.root : Dir.pwd).join('tmp', 'sass-cache')
23
- # @since 0.1.0
24
- # @api private
25
19
  def initialize
26
- @compressor = Sass::Engine
20
+ @compressor = SassC::Engine
27
21
  end
28
22
 
29
23
  # @since 0.1.0
30
24
  # @api private
31
25
  def compress(filename)
32
- compressor.new(read(filename), filename: filename, syntax: :scss,
33
- style: :compressed, cache_location: SASS_CACHE_LOCATION).render
26
+ compressor.new(
27
+ read(filename),
28
+ filename: filename,
29
+ syntax: :scss,
30
+ style: :compressed
31
+ ).render
34
32
  end
35
33
  end
36
34
  end
@@ -233,7 +233,7 @@ module Hanami
233
233
  #
234
234
  # * <tt>:builtin</tt> - Ruby based compressor. It doesn't require any external gem. It's fast, but not an efficient compressor.
235
235
  # * <tt>:yui</tt> - YUI-Compressor, it depends on <tt>yui-compressor</tt> gem and requires Java 1.4+
236
- # * <tt>:sass</tt> - Sass, it depends on <tt>sass</tt> gem
236
+ # * <tt>:sass</tt> - Sass, it depends on <tt>sassc</tt> gem
237
237
  #
238
238
  # @param value [Symbol,#compress] the compressor
239
239
  #
@@ -243,7 +243,7 @@ module Hanami
243
243
  # @see https://rubygems.org/gems/yui-compressor
244
244
  #
245
245
  # @see http://sass-lang.com
246
- # @see https://rubygems.org/gems/sass
246
+ # @see https://rubygems.org/gems/sassc
247
247
  #
248
248
  # @example YUI Compressor
249
249
  # require 'hanami/assets'
@@ -3,6 +3,6 @@ module Hanami
3
3
  # Defines the version
4
4
  #
5
5
  # @since 0.1.0
6
- VERSION = '1.3.1'.freeze
6
+ VERSION = '1.3.2'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2019-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hanami-utils
@@ -149,19 +149,19 @@ dependencies:
149
149
  - !ruby/object:Gem::Version
150
150
  version: '1.1'
151
151
  - !ruby/object:Gem::Dependency
152
- name: sass
152
+ name: sassc
153
153
  requirement: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
- version: '3.4'
157
+ version: '2.0'
158
158
  type: :development
159
159
  prerelease: false
160
160
  version_requirements: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
- version: '3.4'
164
+ version: '2.0'
165
165
  - !ruby/object:Gem::Dependency
166
166
  name: coffee-script
167
167
  requirement: !ruby/object:Gem::Requirement
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  - !ruby/object:Gem::Version
251
251
  version: '0'
252
252
  requirements: []
253
- rubygems_version: 3.0.2
253
+ rubygems_version: 3.0.3
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: Assets management