jekyll-js-converter 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/converters/js.rb +19 -22
- data/lib/jekyll/core_ext/hash.rb +12 -0
- data/lib/jekyll-js-converter/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3266db8f045c5dfc168d25c41ae37cf094c3d6dbe8ffaa4b2ddf90547f486919
|
4
|
+
data.tar.gz: 7630aac486970cfea70a9b3f3b721973113ada5c4a2c8ad5c6e3e6c38c050977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b23f80a19d6ab045ca681cd9ac9037dcab4fae1df175fc2f53e02a24c7be3e0d32a5e770d42cd0955c02f667d7d9254c13ff971a19f970e07471c2f245bf89cf
|
7
|
+
data.tar.gz: 1f7897defebc0406b5af04d17c63dd02a2e9535e5195575c9897862bc69004ccc20c908e72b7e4c5fb78418d28fc5ccadce686ecba6150d64afb02a9d6cf87f8
|
data/lib/jekyll/converters/js.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'uglifier'
|
2
2
|
require 'jekyll/js_source_map_page'
|
3
|
+
require 'jekyll/core_ext/hash'
|
3
4
|
|
4
5
|
module Jekyll
|
5
6
|
module Converters
|
@@ -21,17 +22,17 @@ module Jekyll
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def javascript_config
|
24
|
-
@javascript_config ||= @config['javascript'] || {}
|
25
|
+
@javascript_config ||= @config['javascript'].deep_symbolize_keys || {}
|
25
26
|
end
|
26
27
|
|
27
28
|
def javascript_dir
|
28
|
-
javascript_config[
|
29
|
+
javascript_config[:javascript_dir].to_s.empty? ? '_javascript' : javascript_config[:javascript_dir]
|
29
30
|
end
|
30
31
|
|
31
32
|
def load_paths
|
32
33
|
@load_paths ||= begin
|
33
34
|
paths = [Jekyll.sanitized_path(site.source, javascript_dir)]
|
34
|
-
paths += javascript_config[
|
35
|
+
paths += javascript_config[:load_paths].map { |load_path| File.expand_path(load_path, site.source) } rescue []
|
35
36
|
|
36
37
|
if safe?
|
37
38
|
paths.map! { |path| Jekyll.sanitized_path(site.source, path) }
|
@@ -69,35 +70,31 @@ module Jekyll
|
|
69
70
|
|
70
71
|
def convert(content)
|
71
72
|
if generate_source_map?
|
72
|
-
config = Jekyll::Utils.
|
73
|
-
|
74
|
-
|
75
|
-
:
|
76
|
-
|
77
|
-
|
78
|
-
:filename => @page.name
|
79
|
-
}
|
73
|
+
config = Jekyll::Utils.deep_merge_hashes(
|
74
|
+
{ :uglifier => {
|
75
|
+
:source_map => {
|
76
|
+
:map_url => @source_map_page.name,
|
77
|
+
:sources_content => true,
|
78
|
+
:filename => @page.name
|
80
79
|
}
|
81
|
-
}
|
82
|
-
|
83
|
-
|
80
|
+
}
|
81
|
+
},
|
82
|
+
javascript_config
|
84
83
|
)
|
85
84
|
|
86
|
-
uglified, source_map = Uglifier.new(config[:
|
85
|
+
uglified, source_map = Uglifier.new(config[:uglifier]).compile_with_map(insert_imports(content))
|
87
86
|
|
88
87
|
@source_map_page.source_map(source_map)
|
89
88
|
site.pages << @source_map_page
|
90
89
|
|
91
90
|
uglified
|
92
91
|
else
|
93
|
-
config = Jekyll::Utils.
|
94
|
-
|
95
|
-
|
96
|
-
javascript_config
|
97
|
-
)
|
92
|
+
config = Jekyll::Utils.deep_merge_hashes(
|
93
|
+
{ :uglifier => {} },
|
94
|
+
javascript_config
|
98
95
|
)
|
99
96
|
|
100
|
-
Uglifier.new(config[:
|
97
|
+
Uglifier.new(config[:uglifier]).compile(insert_imports(content))
|
101
98
|
end
|
102
99
|
end
|
103
100
|
|
@@ -155,7 +152,7 @@ module Jekyll
|
|
155
152
|
end
|
156
153
|
|
157
154
|
def source_map_option
|
158
|
-
javascript_config.fetch(
|
155
|
+
javascript_config.fetch(:source_map, :always).to_sym
|
159
156
|
end
|
160
157
|
end
|
161
158
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-js-converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Susco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uglifier
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/jekyll-js-converter.rb
|
90
90
|
- lib/jekyll-js-converter/version.rb
|
91
91
|
- lib/jekyll/converters/js.rb
|
92
|
+
- lib/jekyll/core_ext/hash.rb
|
92
93
|
- lib/jekyll/js_source_map_page.rb
|
93
94
|
homepage: https://github.com/dsusco/jekyll-js-converter
|
94
95
|
licenses:
|
@@ -102,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
103
|
requirements:
|
103
104
|
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
|
-
version: 2.
|
106
|
+
version: 2.5.0
|
106
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
109
|
- - ">="
|