classy_assets 0.4.0 → 0.4.1
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/classy_assets.gemspec +0 -2
- data/lib/classy_assets/configuration.rb +1 -3
- data/lib/classy_assets/version.rb +1 -1
- data/lib/classy_assets.rb +7 -9
- data/lib/rack/classy_assets.rb +3 -1
- data/lib/sass/script/functions.rb +7 -0
- data/spec/classy_assets_spec.rb +1 -1
- data/spec/support/assets/stylesheets/application.scss +1 -1
- metadata +2 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03d29251ccdb2bcc1c12d3dd5f68162410a3cad2
|
4
|
+
data.tar.gz: 7defa03d33fd94492cd8e94c61c9411cb3650283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75cc068bef0fe245c0218e6819d72be0d405e54d5fd779e6a2f453028c57eb5988a9394343ab12d71879e71341c0a57bc3c240bba093f304f0cd00580220ef10
|
7
|
+
data.tar.gz: 8d1cdb94f133d9c632c4b3720e2080ef71c7bcbe8948ccff5401ba3bd9013921e5a4f1603e85f1b67297dbfa8cca2086fcc54763c36d1eb455740e7a0d58d038
|
data/classy_assets.gemspec
CHANGED
@@ -21,8 +21,6 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency 'coffee-script'
|
22
22
|
gem.add_dependency 'sass'
|
23
23
|
gem.add_dependency 'sprockets'
|
24
|
-
gem.add_dependency 'sprockets-sass'
|
25
|
-
gem.add_dependency 'sprockets-helpers'
|
26
24
|
gem.add_dependency 'compass'
|
27
25
|
gem.add_dependency 'uglifier'
|
28
26
|
gem.add_dependency 'yui-compressor'
|
@@ -82,9 +82,7 @@ module ClassyAssets
|
|
82
82
|
|
83
83
|
@sprockets.context_class.class_eval do
|
84
84
|
def asset_path(path, options = {})
|
85
|
-
|
86
|
-
asset = environment.find_asset(path)
|
87
|
-
ClassyAssets.asset_url_for(asset.logical_path)
|
85
|
+
ClassyAssets.asset_url_for(path)
|
88
86
|
end
|
89
87
|
end
|
90
88
|
|
data/lib/classy_assets.rb
CHANGED
@@ -4,25 +4,17 @@ require 'compass'
|
|
4
4
|
require 'sass'
|
5
5
|
require 'coffee_script'
|
6
6
|
require 'sprockets'
|
7
|
-
require 'sprockets-sass'
|
8
7
|
require 'sinatra/base'
|
9
8
|
require 'classy_assets/configuration'
|
10
9
|
require 'classy_assets/version'
|
11
10
|
|
12
11
|
module ClassyAssets
|
13
12
|
def self.asset_url_for(asset)
|
14
|
-
asset =
|
15
|
-
asset = build_digest_filename(asset) if Configuration.asset_digest
|
13
|
+
asset = Configuration.sprockets[asset].send(determine_path_type)
|
16
14
|
debug = (Configuration.debug_mode) ? '?body=1' : ''
|
17
15
|
"#{Configuration.asset_host}/#{Configuration.asset_prefix}/#{asset}#{debug}"
|
18
16
|
end
|
19
17
|
|
20
|
-
def self.build_digest_filename(asset)
|
21
|
-
filename = asset.split(".")
|
22
|
-
ext = filename.pop
|
23
|
-
"#{filename.join('.')}-#{Configuration.sprockets.digest}.#{ext}"
|
24
|
-
end
|
25
|
-
|
26
18
|
def self.asset_tag_from(sources, ext)
|
27
19
|
sources = [sources] unless sources.is_a? Array
|
28
20
|
sources.map do |source|
|
@@ -31,4 +23,10 @@ module ClassyAssets
|
|
31
23
|
yield(asset_url)
|
32
24
|
end.join('')
|
33
25
|
end
|
26
|
+
|
27
|
+
def self.determine_path_type
|
28
|
+
(Configuration.asset_digest) ? :digest_path : :logical_path
|
29
|
+
end
|
34
30
|
end
|
31
|
+
|
32
|
+
require 'sass/script/functions'
|
data/lib/rack/classy_assets.rb
CHANGED
@@ -6,8 +6,10 @@ module Rack
|
|
6
6
|
class ClassyAssets < Sinatra::Base
|
7
7
|
::ClassyAssets::Configuration.sprockets.mime_types.each do |ext, content_type|
|
8
8
|
get "/#{::ClassyAssets::Configuration.asset_prefix}/*#{ext}" do |asset|
|
9
|
+
filename = "#{asset}#{ext}"
|
10
|
+
filename.gsub!(/-(\h{32})#{ext}$/, ext) if ::ClassyAssets::Configuration.asset_digest
|
9
11
|
content_type content_type
|
10
|
-
::ClassyAssets::Configuration.sprockets[
|
12
|
+
::ClassyAssets::Configuration.sprockets[filename] || halt(404)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
data/spec/classy_assets_spec.rb
CHANGED
@@ -45,7 +45,7 @@ describe ClassyAssets do
|
|
45
45
|
|
46
46
|
it "returns the digest url to the asset" do
|
47
47
|
asset_url = ClassyAssets.asset_url_for 'application.js'
|
48
|
-
asset_url.must_equal "/assets
|
48
|
+
asset_url.must_equal "/assets/#{ClassyAssets::Configuration.sprockets['application.js'].digest_path}"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StyleSeek Engineering
|
@@ -52,34 +52,6 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: sprockets-sass
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: sprockets-helpers
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: compass
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +174,7 @@ files:
|
|
202
174
|
- lib/classy_assets/tasks/assets.rake
|
203
175
|
- lib/classy_assets/version.rb
|
204
176
|
- lib/rack/classy_assets.rb
|
177
|
+
- lib/sass/script/functions.rb
|
205
178
|
- lib/sinatra/classy_assets.rb
|
206
179
|
- spec/classy_assets/configuration_spec.rb
|
207
180
|
- spec/classy_assets_spec.rb
|