asset 0.2.0 → 0.2.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/README.md +4 -3
- data/asset.gemspec +2 -2
- data/lib/asset.rb +5 -2
- data/lib/assets/filters.rb +3 -0
- data/lib/assets/router.rb +1 -1
- data/lib/assets/util.rb +7 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97797bb9b02ffca18a74539c99311a5e340428cb
|
4
|
+
data.tar.gz: fbca1ddac3acb66ee358d6eca68aa48f3928fbf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54f28fa505aea145ffddec9353083f98c6a68eb16330e67ebed7747faafa684a846dc60d4df6240af3becaf77cc61dc3f631f7b3d3b09a2c2dbc866b259ff621
|
7
|
+
data.tar.gz: f105cdbb7c3d3db7643768ac4fe6059ae86667837fd532e9491d81ea0bdb7823c0adc52bbdc44dbad1471a9bc5a07ecee6b4ccbe41ed6a18698fd8ae4ec4b8c4
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
Compress and cache your Javascript and CSS files automatically.
|
4
4
|
|
5
|
-
Set up your manifest file, install the helpers and the middleware, and you're up and running with compressed assets served lightning fast on pure
|
5
|
+
Set up your manifest file, install the helpers and the middleware, and you're up and running with compressed assets served lightning fast on pure Rack.
|
6
|
+
|
7
|
+
All assets are loaded only once, and then stored in the browser disk cache, making your pages load in milliseconds. This is a must-have for any web site.
|
6
8
|
|
7
9
|
### Installation
|
8
10
|
```
|
@@ -69,10 +71,9 @@ js:
|
|
69
71
|
|
70
72
|
In development mode, all files will be printed. In production mode, you'll get only one file.
|
71
73
|
|
72
|
-
The file will also be cached and compressed. The cache auto-expires
|
74
|
+
The file will also be cached and compressed. The cache auto-expires.
|
73
75
|
|
74
76
|
### Middleware
|
75
|
-
|
76
77
|
The Asset gem also comes with Rack middleware to handle requests for your assets.
|
77
78
|
|
78
79
|
```ruby
|
data/asset.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'asset'
|
3
|
-
s.version = '0.2.
|
4
|
-
s.date = '2017-
|
3
|
+
s.version = '0.2.1'
|
4
|
+
s.date = '2017-06-12'
|
5
5
|
s.summary = "Compress and serve your CSS and JS assets automatically"
|
6
6
|
s.description = "The only thing you need for your assets."
|
7
7
|
s.authors = ["Fugroup Limited"]
|
data/lib/asset.rb
CHANGED
@@ -11,9 +11,9 @@ module Asset
|
|
11
11
|
autoload :Uglifier, 'uglifier'
|
12
12
|
autoload :Sass, 'sass'
|
13
13
|
|
14
|
-
class << self; attr_accessor :mode, :path, :cache, :favicon, :robots, :manifest, :bundle, :images, :listener, :debug; end
|
14
|
+
class << self; attr_accessor :mode, :path, :cache, :favicon, :robots, :manifest, :bundle, :images, :listener, :symlinks, :debug; end
|
15
15
|
|
16
|
-
# Default is
|
16
|
+
# Default is production
|
17
17
|
@mode = ENV['RACK_ENV'] || 'production'
|
18
18
|
|
19
19
|
# Where your assets live
|
@@ -31,6 +31,9 @@ module Asset
|
|
31
31
|
# Reset the assets on change in development mode
|
32
32
|
@listener = true
|
33
33
|
|
34
|
+
# Follow symlinks in assets
|
35
|
+
@symlinks = false
|
36
|
+
|
34
37
|
# Debug option
|
35
38
|
@debug = false
|
36
39
|
end
|
data/lib/assets/filters.rb
CHANGED
data/lib/assets/router.rb
CHANGED
data/lib/assets/util.rb
CHANGED
@@ -33,7 +33,7 @@ module Asset
|
|
33
33
|
|
34
34
|
# Load manifest
|
35
35
|
def self.load_manifest
|
36
|
-
Dir["#{Asset.path}/{css,js}
|
36
|
+
Dir["#{Asset.path}/{css,js}/#{pattern}"].uniq.map do |f|
|
37
37
|
# Extract type and name
|
38
38
|
f =~ /(js|css)\/(.+)$/; type, name = $1, $2
|
39
39
|
|
@@ -57,12 +57,17 @@ module Asset
|
|
57
57
|
# Load images into memory
|
58
58
|
def self.load_images
|
59
59
|
# Store the path and the timestamp
|
60
|
-
img = Dir["#{::Asset.path}/images
|
60
|
+
img = Dir["#{::Asset.path}/images/#{pattern}"].uniq.map do |i|
|
61
61
|
i =~ /\/images\/(.+)/; [$1, mtime("images/#{$1}").to_i]
|
62
62
|
end
|
63
63
|
Hash[*img.flatten]
|
64
64
|
end
|
65
65
|
|
66
|
+
# File match pattern
|
67
|
+
def self.pattern
|
68
|
+
::Asset.symlinks ? '**{,/*/**}/*.*' : '**/*.*'
|
69
|
+
end
|
70
|
+
|
66
71
|
# Production mode?
|
67
72
|
def self.p?
|
68
73
|
%w[staging production].include?(::Asset.mode)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fugroup Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.6.
|
249
|
+
rubygems_version: 2.6.10
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Compress and serve your CSS and JS assets automatically
|