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 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
@@ -0,0 +1 @@
1
+ * @researchsquare/Customer
@@ -0,0 +1,4 @@
1
+ **Summary**:
2
+
3
+
4
+ **Test Plan**:
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /tmp/
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
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {"https://github.com/researchsquare/jekyll-asset-url"}
4
+
5
+ # Specify your gem's dependencies in jekyll-translations.gemspec
6
+ gemspec
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -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: []