classy_assets 0.6.3 → 0.7.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
2
  SHA1:
3
- metadata.gz: 6e7a76151bc11ded83514642f16717607b5fa409
4
- data.tar.gz: dc9d1824bd1961e67295d54c0b14b871bb3cec0b
3
+ metadata.gz: 338d84f565e2057f9a14cbb00f13a9e34bb52875
4
+ data.tar.gz: 61d55ee7754f8ee91d80b6ed98981f25dcac4284
5
5
  SHA512:
6
- metadata.gz: f6e2b2a8a43c71eb1bfeaa39dfb4ed88be62d32740261b89370da5de2d2ec9fb9dced0f383420a76426aed0638dac7e0d1d669befc47e858091e8edc201ed475
7
- data.tar.gz: 0ec959bcb6b9d23f8e92878999c713c8e0cb3f3110e25aa6e206d28650ebfca7c22c19dc0e0c73e945171fbfa21db55f208279c7f688545eb4744209fb1ee53c
6
+ metadata.gz: 748e3597bfb6919d263be0e323e52c27f7b6916c1b868876de30621bdc91898f9a442b32546b0aa5e8bd94ecbcad98cc599377caf6639a0c6975b9affbc3b579
7
+ data.tar.gz: cdb7d4c4729b85d7821fee753ed7eb077ca3f2e19f55161bddbbf994c36c36ed28d4b131bbe3e456f4270f43a294f2910facd9f443dd594a499fbde12ff41496
@@ -7,18 +7,32 @@ module ClassyAssets
7
7
  include Singleton
8
8
 
9
9
  attr_accessor :asset_debug, :asset_digest, :asset_host, :asset_paths, :asset_prefix, :asset_root
10
+ attr_accessor :asset_compress, :css_compressor, :js_compressor
11
+
12
+ def asset_compress
13
+ @asset_compress if defined? @asset_compress
14
+ end
15
+
16
+ def css_compressor
17
+ @css_compressor ||= :yui
18
+ end
19
+
20
+ def js_compressor
21
+ @js_compressor ||= :uglifier
22
+ end
10
23
 
11
24
  def asset_debug
12
- @asset_debug.nil? ? (ENV['RACK_ENV'] == 'development') : @asset_debug
25
+ @asset_debug = (ENV['RACK_ENV'] == 'development') unless defined? @asset_debug
26
+ @asset_debug
13
27
  end
14
28
 
15
29
  def asset_digest
16
- @asset_digest.nil? ? false : @asset_digest
30
+ @asset_digest if defined? @asset_digest
17
31
  end
18
32
 
19
33
  def asset_paths
20
- @asset_paths ||= build_asset_paths
21
- @asset_paths.uniq! # ensure no duplicates
34
+ @asset_paths = build_asset_paths unless defined? @asset_paths
35
+ @asset_paths.uniq!
22
36
  @asset_paths
23
37
  end
24
38
 
@@ -15,6 +15,11 @@ module ClassyAssets
15
15
  @environment.append_path asset_path
16
16
  end
17
17
 
18
+ if ClassyAssets.config.asset_compress
19
+ @environment.css_compressor = ClassyAssets.config.css_compressor
20
+ @environment.js_compressor = ClassyAssets.config.css_compressor
21
+ end
22
+
18
23
  @environment.context_class.class_eval do
19
24
  def asset_path(path, options = {})
20
25
  ClassyAssets.asset_url_for(path)
@@ -1,3 +1,3 @@
1
1
  module ClassyAssets
2
- VERSION = "0.6.3"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe ClassyAssets::Config do
6
- before do
6
+ before(:all) do
7
7
  @asset_root = File.expand_path('../../support', __FILE__)
8
8
  @asset_host = 'http://example.com'
9
9
  @asset_prefix = 'assets'
@@ -23,6 +23,18 @@ describe ClassyAssets::Config do
23
23
  @configuration = ClassyAssets.config
24
24
  end
25
25
 
26
+ it "returns the configured asset_compress" do
27
+ @configuration.asset_compress.must_equal nil
28
+ end
29
+
30
+ it "returns the configured css_compressor" do
31
+ @configuration.css_compressor.must_equal :yui
32
+ end
33
+
34
+ it "returns the configured js_compressor" do
35
+ @configuration.js_compressor.must_equal :uglifier
36
+ end
37
+
26
38
  it "returns the configured asset_debug" do
27
39
  @configuration.asset_debug.must_equal true
28
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classy_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - StyleSeek Engineering