jekyll-asset-url 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 +7 -0
- data/.github/CODEOWNERS +1 -0
- data/.github/PULL_REQUEST_TEMPLATE +4 -0
- data/.gitignore +7 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +6 -0
- data/README.md +35 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jekyll-asset-url.gemspec +11 -0
- data/lib/jekyll-asset-url.rb +1 -0
- data/lib/jekyll/asset-url.rb +29 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1a19ba6b5727b104b782734021ff6c9ee2d4bfecbbde00a6a791f89b50254d28
|
4
|
+
data.tar.gz: 563ccc7d9ecb9bd41bd77d2e6471b4cf610ce1296b73e4e994de74ef02d0bc56
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71ee6ab12acaa96e40d5927971ee73d5e741371afcf67e2917ba2246f74ad7bb9756f9e9410d45295e318da670ec2388ae42448c41297b75d1cb415efd8824fb
|
7
|
+
data.tar.gz: 1701d72e95dc0a7a812009976e6bd86ac3adca865c41221dd47b83b1e85ae6ad4c25e8ff5722dac385bf1a73a85ab4b3270fc55de2deabe0457d001e41f03aed
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @researchsquare/Customer
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [1.0.0] - 2020-06-10
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- Added base functionality
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Jekyll::AssetUrl
|
2
|
+
|
3
|
+
This is a Jekyll plugin to map javascript files to their generated file names.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'jekyll-asset-url'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install jekyll-asset-url
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
This plugin is intended to be used in conjunction with [`WebpackManifestPlugin`](https://github.com/shellscape/webpack-manifest-plugin). To use, add the following to `_config.yml`:
|
24
|
+
|
25
|
+
```yml
|
26
|
+
# _config.yml
|
27
|
+
assetManifest: '<relative path to manifest>'
|
28
|
+
```
|
29
|
+
|
30
|
+
Then, in your code, use the {{asset_url}} filter:
|
31
|
+
|
32
|
+
```html
|
33
|
+
<!-- footer.html -->
|
34
|
+
<script type="text/javascript" src="{{ /dist/scripts/app.js | asset_url }}"></script>
|
35
|
+
```
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jekyll/asset-url"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "jekyll-asset-url"
|
3
|
+
spec.version = "1.0.0"
|
4
|
+
spec.authors = ["Scott Dover"]
|
5
|
+
spec.email = ["scott.dover@researchsquare.com"]
|
6
|
+
spec.require_paths = ["lib"]
|
7
|
+
spec.summary = %q{Dynaic asset urls for Jekyll}
|
8
|
+
spec.homepage = "https://github.com/researchsquare/jekyll-asset-url"
|
9
|
+
spec.license = "MIT"
|
10
|
+
spec.files = `git ls-files -z`.split("\x0")
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'jekyll/asset-url'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Jekyll
|
2
|
+
require 'json'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
module AssetUrl
|
6
|
+
def asset_url(input)
|
7
|
+
begin
|
8
|
+
manifest_location = @context.registers[:site].config['assetManifest']
|
9
|
+
manifest_data = JSON.parse(open(manifest_location).read)
|
10
|
+
rescue
|
11
|
+
return input
|
12
|
+
end
|
13
|
+
|
14
|
+
mapped_file_name = ""
|
15
|
+
manifest_data.each do |key, value|
|
16
|
+
if input.include? key
|
17
|
+
mapped_file_name = File.basename(value)
|
18
|
+
break
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
return input if mapped_file_name.empty?
|
23
|
+
|
24
|
+
return input.gsub(File.basename(input), mapped_file_name)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Liquid::Template.register_filter(Jekyll::AssetUrl)
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-asset-url
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Dover
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- scott.dover@researchsquare.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".github/CODEOWNERS"
|
21
|
+
- ".github/PULL_REQUEST_TEMPLATE"
|
22
|
+
- ".gitignore"
|
23
|
+
- CHANGELOG.md
|
24
|
+
- Gemfile
|
25
|
+
- README.md
|
26
|
+
- bin/console
|
27
|
+
- bin/setup
|
28
|
+
- jekyll-asset-url.gemspec
|
29
|
+
- lib/jekyll-asset-url.rb
|
30
|
+
- lib/jekyll/asset-url.rb
|
31
|
+
homepage: https://github.com/researchsquare/jekyll-asset-url
|
32
|
+
licenses:
|
33
|
+
- MIT
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubygems_version: 3.0.4
|
51
|
+
signing_key:
|
52
|
+
specification_version: 4
|
53
|
+
summary: Dynaic asset urls for Jekyll
|
54
|
+
test_files: []
|