middleman-appcache 1.0.0 → 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: cd1fa53cde33a152eb11d4fe81154f7308316c4c
4
- data.tar.gz: 096505d049dd0c7b57eb3d6a6894f649ddcca13f
3
+ metadata.gz: ff3c0e8e1908b28b41d986c053ea2e85edf98eb4
4
+ data.tar.gz: 052074f5070aea717c0f26a3534a298693222f23
5
5
  SHA512:
6
- metadata.gz: cfd67fbaa329e9abe78ddf57b5cde6c4ac2b5e6759a60d4ece822866a485e49a8b01dbe03fb3f25ae76e1327a0032067ea6fb21106ecd674196cb7d234a04e86
7
- data.tar.gz: f19168e95979a4c448c03671be2da9c7108ac7b8550bfa07f153980f2d359be02dc5d3de3f71c7e3ee28886076c4acf235920776f5d6079d4445b49c3c435e06
6
+ metadata.gz: 1d28408b8b6acaf4bf4e10e21c6e60a2c3f596be221a801ab34a64042fb017c6b987b03c6d89c4a4370ce86ed873acc4e5a888b2b2a92b7b4b7601bb8122d3e5
7
+ data.tar.gz: 282a26b428c25f39925cb9e94b1f1073cae59079437dab8a0d0a433062c2121c6299ed01bb6fd9321ac54b2b1700496659dbd7e527f3e7f7456b8d913a5e7395
data/README.md CHANGED
@@ -49,6 +49,7 @@ activate :app_cache do |config|
49
49
  config.fallback = {
50
50
  '/' => 'offline.html'
51
51
  }
52
+ config.use_relative = false
52
53
  end
53
54
  ```
54
55
 
@@ -73,7 +74,7 @@ NETWORK:
73
74
  /logout
74
75
 
75
76
  FALLBACK:
76
- / offline.html
77
+ / /offline.html
77
78
 
78
79
  ```
79
80
 
@@ -107,6 +108,12 @@ The mapping of fallback resources if a resource is unavailable.
107
108
 
108
109
  **Default:** `Empty`
109
110
 
111
+ ### use_relative
112
+
113
+ If the resources should be treated as relative from the appcache.
114
+
115
+ **Default:** `true`
116
+
110
117
  ## License
111
118
 
112
119
  Middleman Application Cache was created by [Ryan Scott](http://github.com/archytaus) is distributed under the [MIT](http://ryanscott.mit-license.org) license.
@@ -8,7 +8,8 @@ module Middleman
8
8
  option :cache, ['index.html'], 'List of directories or files that will be cached.'
9
9
  option :network, ['*'], 'Resources that require the user to be online.'
10
10
  option :fallback, {}, 'Fallback resources if a resource is unavailable.'
11
-
11
+ option :use_relative, true, 'If the cached files should be generated as relative paths.'
12
+
12
13
  def initialize app, options_hash = {}, &block
13
14
  super
14
15
 
@@ -16,7 +17,8 @@ module Middleman
16
17
  cache_options = options.cache
17
18
  network_options = options.network
18
19
  fallback_options = options.fallback
19
-
20
+ use_relative = options.use_relative
21
+
20
22
  app.after_build do |builder|
21
23
  cache = []
22
24
 
@@ -24,7 +26,9 @@ module Middleman
24
26
  directory = File.join(config[:build_dir], cache_file_pattern)
25
27
  files_to_cache = Dir.glob(directory)
26
28
  files_to_cache.each do |file_to_cache|
27
- cache << file_to_cache.gsub(config[:build_dir], '')
29
+ build_dir = config[:build_dir]
30
+ build_dir = "#{build_dir}/" if use_relative
31
+ cache << file_to_cache.gsub(build_dir, '')
28
32
  end
29
33
  end
30
34
 
@@ -1,7 +1,7 @@
1
1
  module Middleman
2
2
 
3
3
  module AppCache
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-appcache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Scott