middleman-asset-http-prefix 0.0.3 → 1.0.0
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 +14 -2
- data/lib/middleman-asset-http-prefix.rb +9 -5
- data/middleman-asset-http-prefix.gemspec +2 -2
- metadata +5 -6
- data/lib/middleman_extension.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b467b9f5867941d42f54e072fb2fa4af133b20
|
4
|
+
data.tar.gz: 537dfecaaf7a8ab0b6edbe22bf0b73dc71c8cc0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2202456118ff6eb10150bf9f9ea4ff259e3471749144c7d9b604d1d63d3d68ff40a07bcc6e81a46f7a8ab8e8b9418d901beacdfe15a08610aaa100dcfc3f4cd3
|
7
|
+
data.tar.gz: ead7947419c89e943a6cc9ec3a280d10fecf87524295d44136b0eaf47a46c3f6bbcc7b43cb54146a1542a590691efbd076b7b095c194ff6e6c27ff84d8b2f1af
|
data/README.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
-
# middleman-asset-http-prefix
|
2
|
-
|
3
1
|
[](http://badge.fury.io/rb/middleman-asset-http-prefix)
|
2
|
+
|
3
|
+
## Usage
|
4
|
+
|
5
|
+
In the build section of config.rb:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
configure :build do
|
9
|
+
activate :asset_http_prefix
|
10
|
+
|
11
|
+
# and set the prefixes
|
12
|
+
set :http_prefix, 'https://www.example.com'
|
13
|
+
set :asset_http_prefix, 'https://cdn.example.com'
|
14
|
+
end
|
15
|
+
```
|
@@ -1,19 +1,20 @@
|
|
1
|
-
#
|
1
|
+
# rubocop:disable Naming/FileName, Lint/MissingCopEnableDirective, Metrics/MethodLength, Metrics/LineLength
|
2
2
|
require 'middleman-core'
|
3
3
|
|
4
|
-
#
|
4
|
+
# Override the asset_url helper to make use of asset_http_prefix, if defined
|
5
5
|
class AssetHttpPrefix < ::Middleman::Extension
|
6
6
|
helpers do
|
7
7
|
def asset_url(path, prefix = '', **options)
|
8
8
|
begin
|
9
9
|
original_output = super
|
10
|
-
rescue
|
10
|
+
rescue StandardError
|
11
11
|
original_output = super(path, prefix)
|
12
12
|
end
|
13
13
|
|
14
14
|
if config[:asset_http_prefix]
|
15
15
|
original_output.sub(
|
16
|
-
/^#{Regexp.escape(config[:http_prefix])}/, config[:asset_http_prefix]
|
16
|
+
/^#{Regexp.escape(config[:http_prefix])}/, config[:asset_http_prefix]
|
17
|
+
)
|
17
18
|
else
|
18
19
|
original_output
|
19
20
|
end
|
@@ -21,4 +22,7 @@ class AssetHttpPrefix < ::Middleman::Extension
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
+
Middleman::Extensions.register :asset_http_prefix do
|
26
|
+
require 'middleman-asset-http-prefix'
|
27
|
+
AssetHttpPrefix
|
28
|
+
end
|
@@ -3,7 +3,7 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'middleman-asset-http-prefix'
|
6
|
-
s.version = '0.0
|
6
|
+
s.version = '1.0.0'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ['Ryan Mark']
|
9
9
|
s.email = ['ryan@mrk.cc']
|
@@ -16,5 +16,5 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
|
18
18
|
# The version of middleman-core your extension depends on
|
19
|
-
s.add_runtime_dependency('middleman-core', ['>=
|
19
|
+
s.add_runtime_dependency('middleman-core', ['>= 4', '< 5'])
|
20
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-asset-http-prefix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Mark
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '4'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '5'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '4'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '5'
|
33
33
|
description:
|
34
34
|
email:
|
35
35
|
- ryan@mrk.cc
|
@@ -43,7 +43,6 @@ files:
|
|
43
43
|
- Rakefile
|
44
44
|
- features/support/env.rb
|
45
45
|
- lib/middleman-asset-http-prefix.rb
|
46
|
-
- lib/middleman_extension.rb
|
47
46
|
- middleman-asset-http-prefix.gemspec
|
48
47
|
homepage: https://github.com/ryanmark/middleman-asset-http-prefix
|
49
48
|
licenses: []
|
data/lib/middleman_extension.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'middleman-asset-http-prefix'
|