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 +4 -4
- data/lib/classy_assets/config.rb +18 -4
- data/lib/classy_assets/sprockets.rb +5 -0
- data/lib/classy_assets/version.rb +1 -1
- data/spec/classy_assets/config_spec.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 338d84f565e2057f9a14cbb00f13a9e34bb52875
|
4
|
+
data.tar.gz: 61d55ee7754f8ee91d80b6ed98981f25dcac4284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 748e3597bfb6919d263be0e323e52c27f7b6916c1b868876de30621bdc91898f9a442b32546b0aa5e8bd94ecbcad98cc599377caf6639a0c6975b9affbc3b579
|
7
|
+
data.tar.gz: cdb7d4c4729b85d7821fee753ed7eb077ca3f2e19f55161bddbbf994c36c36ed28d4b131bbe3e456f4270f43a294f2910facd9f443dd594a499fbde12ff41496
|
data/lib/classy_assets/config.rb
CHANGED
@@ -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
|
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
|
30
|
+
@asset_digest if defined? @asset_digest
|
17
31
|
end
|
18
32
|
|
19
33
|
def asset_paths
|
20
|
-
@asset_paths
|
21
|
-
@asset_paths.uniq!
|
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)
|
@@ -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
|