asset 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/asset.gemspec +2 -1
- data/lib/asset.rb +18 -9
- data/lib/assets/util.rb +12 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8bb24feacfd52ac3d781e350fb69baf17d96efa
|
4
|
+
data.tar.gz: fe54f8ba994df28627af3deb0fa2ce2a4df8cc41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cf5ec7f3b08f25ff879f960e894c6d49654a1e9264b5edaa938a732eb5f00f5acf14c7f140e7e800b30830d2befc30b81bec9420741b150be7f4a987aea64ef
|
7
|
+
data.tar.gz: f52fd0cffd5a48b9305010751025ed34a51958be0fc69f9a2f31e995a6c1941795adbf24b88b549022c60962692de0842daeec4c1af84835b8e45534888b64a5
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/asset.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'asset'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.9'
|
4
4
|
s.date = '2017-01-19'
|
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."
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency 'request_store', '>= 0'
|
21
21
|
s.add_development_dependency 'fuprint', '>= 0'
|
22
22
|
s.add_development_dependency 'futest', '>= 0'
|
23
|
+
s.add_development_dependency 'listen', '>= 0'
|
23
24
|
|
24
25
|
s.homepage = 'https://github.com/fugroup/asset'
|
25
26
|
s.license = 'MIT'
|
data/lib/asset.rb
CHANGED
@@ -10,7 +10,7 @@ module Asset
|
|
10
10
|
autoload :Uglifier, 'uglifier'
|
11
11
|
autoload :Sass, 'sass'
|
12
12
|
|
13
|
-
class << self; attr_accessor :mode, :path, :cache, :favicon, :robots, :manifest, :bundle, :images, :debug; end
|
13
|
+
class << self; attr_accessor :mode, :path, :cache, :favicon, :robots, :manifest, :bundle, :images, :listener, :debug; end
|
14
14
|
|
15
15
|
# Default is development
|
16
16
|
@mode = ENV['RACK_ENV'] || 'development'
|
@@ -27,6 +27,9 @@ module Asset
|
|
27
27
|
# Send /robots.txt to a standard robots txt with reference to /sitemap.xml
|
28
28
|
@robots = true
|
29
29
|
|
30
|
+
# Reset the assets on change in development mode
|
31
|
+
@listener = true
|
32
|
+
|
30
33
|
# Debug option
|
31
34
|
@debug = false
|
32
35
|
end
|
@@ -34,15 +37,21 @@ end
|
|
34
37
|
require_relative 'assets/util'
|
35
38
|
require_relative 'assets/item'
|
36
39
|
|
37
|
-
|
38
|
-
::Asset.manifest = ::Asset::Util.load_manifest
|
39
|
-
|
40
|
-
# Load the bundle
|
41
|
-
::Asset.bundle = YAML.load_file(File.join(::Asset.path, 'manifest.yml'))
|
42
|
-
|
43
|
-
# Load the images
|
44
|
-
::Asset.images = ::Asset::Util.load_images
|
40
|
+
::Asset::Util.setup!
|
45
41
|
|
46
42
|
require_relative 'assets/helpers'
|
47
43
|
require_relative 'assets/filters'
|
48
44
|
require_relative 'assets/router'
|
45
|
+
|
46
|
+
# Run a listener to automatically reload the assets on change
|
47
|
+
if ::Asset.listener and ::Asset.mode == 'development'
|
48
|
+
autoload :Listen, 'listen'
|
49
|
+
|
50
|
+
if defined?(Listen)
|
51
|
+
# Reload assets on change
|
52
|
+
listener = Listen.to(::Asset.path) do |modified, added, removed|
|
53
|
+
::Asset::Util.setup!
|
54
|
+
end
|
55
|
+
listener.start
|
56
|
+
end
|
57
|
+
end
|
data/lib/assets/util.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
module Asset
|
2
2
|
class Util
|
3
3
|
|
4
|
+
# Setup assets
|
5
|
+
def self.setup!
|
6
|
+
# Load the manifest
|
7
|
+
::Asset.manifest = load_manifest
|
8
|
+
|
9
|
+
# Load the bundle
|
10
|
+
::Asset.bundle = YAML.load_file(File.join(::Asset.path, 'manifest.yml'))
|
11
|
+
|
12
|
+
# Load the images
|
13
|
+
::Asset.images = load_images
|
14
|
+
end
|
15
|
+
|
4
16
|
# Get timestamp
|
5
17
|
def self.mtime(path)
|
6
18
|
File.mtime(asset_path(path)).utc
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fugroup Limited
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: listen
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
description: The only thing you need for your assets.
|
168
182
|
email: vidar@fugroup.net
|
169
183
|
executables: []
|