nanoc-sprockets3 1.0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52611d2cfa03fe313781712dca2de841e01ec055
4
- data.tar.gz: cd41d0f48ce71ca8f7efd4dcbe4b175a1780843f
3
+ metadata.gz: 79dd5c797aa087ef26a0d1e21bc59730d0b71aac
4
+ data.tar.gz: dd679452f9198964c6705fcabcda002f67cd6bba
5
5
  SHA512:
6
- metadata.gz: 77775cc7d0fc9129c2d353febd6dbbc3c764db8bcfecaeb1d926869d5a913f759eab8830757932bf917fa9a3669072f4cb51f0a17c522d41352a5be6819a0940
7
- data.tar.gz: 15b1e2e5f8fe870792731e199a5f2e2287ad348db9aa18c17c788ae1aead1074771415e7bbaffe097e73c0a56e86025ae0d1bf3a43f1fef7ad4d5a14cbf2391c
6
+ metadata.gz: 78624dc8241fad6ba87478c00902e1cbd11f9982dc1ff8ce35a554032dba021de35411c2ea2e01a4c47c14c64a8dc9d013f4d2ee96e0349acccc0f9f6a9d27a7
7
+ data.tar.gz: e23d089b78c89803c2bc0bbb8827732dc01d69d899d4a498a8494d5d2f0aaaef081946608e4d48b2a523963d694f54661276ee7f43d4399bb31988ca59067578
data/README.md CHANGED
@@ -29,9 +29,12 @@ Or install it yourself as:
29
29
  ## Configuration
30
30
 
31
31
  [nanoc-sprockets3][nanoc-sprockets3] does not require any mandatory configuration, however you may want to configure it
32
- for your needs. Currently you can configure [nanoc-sprockets3][nanoc-sprockets3] with two parameters:
33
- - *prefix* which is the prefix to give to all assets
34
- - *environment* which is the Sprockets environment to use
32
+ for your needs.
33
+
34
+ Currently you can configure [nanoc-sprockets3][nanoc-sprockets3] with the following parameters:
35
+ - **prefix** *[default: '/asset']* which is the prefix to give to all assets
36
+ - **digest** *[default: false]* which when true will return digest paths instead of logical path
37
+ - **environment** which is the Sprockets environment to use
35
38
 
36
39
  The default environment is configured with the following paths
37
40
  - content/assets/
@@ -66,6 +69,7 @@ Nanoc::Sprockets::Helper.configure do |config|
66
69
  env.append_path 'vendor/assets/jquery'
67
70
  end
68
71
  config.prefix = '/assets'
72
+ config.digest = true
69
73
  end
70
74
  ```
71
75
 
@@ -139,4 +143,4 @@ for dependency tracking which makes it annoying to use with livereload and parti
139
143
  [nanoc-sprockets-filter]: https://github.com/yannlugrin/nanoc-sprockets-filter "A nanoc filter to use Sprocket 2.x"
140
144
  [nanoc-sprockets]: https://github.com/stormz/nanoc-sprockets "Use sprockets 2.x as a datasource for nanoc"
141
145
  [nanoc-gzip-filter]: https://github.com/yannlugrin/nanoc-gzip-filter "A Nanoc filter to gzip content"
142
- [uglifier]: https://github.com/lautis/uglifier "Ruby wrapper for UglifyJS JavaScript compressor"
146
+ [uglifier]: https://github.com/lautis/uglifier "Ruby wrapper for UglifyJS JavaScript compressor"
@@ -21,7 +21,7 @@ module Nanoc::Sprockets
21
21
  # This defaults to the context's #environment method.
22
22
  def environment
23
23
  @environment ||= ::Sprockets::Environment.new(File.expand_path('.')) do |env|
24
- paths = DEFAULT_ASSETS_DIRS + DEFAULT_ASSETS_PATHS.map{|p| DEFAULT_ASSETS_DIRS.map{|f| "#{p}#{f}"}}.flatten
24
+ paths = DEFAULT_ASSETS_PATHS + DEFAULT_ASSETS_PATHS.map{|p| DEFAULT_ASSETS_DIRS.map{|f| "#{p}#{f}"}}.flatten
25
25
  paths.each{ |path| env.append_path path }
26
26
  end
27
27
  end
@@ -34,6 +34,8 @@ module Nanoc::Sprockets
34
34
  end
35
35
  attr_writer :prefix
36
36
 
37
+ # When true, the asset paths will return digest paths
38
+ attr_accessor :digest
37
39
  end
38
40
 
39
41
  # Convience method for configuring Nanoc::Sprockets::Helpers.
@@ -41,7 +43,7 @@ module Nanoc::Sprockets
41
43
  yield self
42
44
  end
43
45
 
44
- # Returns the path to an item or a filename either in the Sprockets environment.
46
+ # Returns the path to an item or a filename in the Sprockets environment.
45
47
  def asset_path(item_or_filename, options = {})
46
48
  if item_or_filename.is_a?(::Nanoc::Item)
47
49
  filename = item_or_filename[:filename]
@@ -50,8 +52,12 @@ module Nanoc::Sprockets
50
52
  end
51
53
  filename = File.basename(filename).gsub(/^(\w+\.\w+).*/, '\1')
52
54
 
53
- if asset = Helper.environment[filename]
54
- File.join(Helper.prefix, asset.logical_path)
55
+ if asset = Helper.environment.find_asset(filename)
56
+ if Helper.digest
57
+ File.join(Helper.prefix, asset.digest_path)
58
+ else
59
+ File.join(Helper.prefix, asset.logical_path)
60
+ end
55
61
  else
56
62
  raise "error locating #{filename}."
57
63
  end
@@ -1,5 +1,5 @@
1
1
  module Nanoc
2
2
  module Sprockets
3
- VERSION = "1.0.0.1"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-sprockets3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remi Barraquand