jekyll-js-converter 0.0.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-js-converter/version.rb +1 -1
- data/lib/jekyll/converters/js.rb +13 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01a1eeed7b7f346b0419859c5c4f59cd735c311f4f80ab1571147abf0d82cf66
|
4
|
+
data.tar.gz: 004070e0d99a326d423b20bf8bb3691c98e05d7e1089f7262304c3740317e297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27142c7333b1ba84a3dea919ff2f3614e23b8d4f783f8c7280b97e55e6d9266924e0af3ddc1be79ba0ee6f9368013a2e70918ce18c03a9204d4dc25ca6cd86cb
|
7
|
+
data.tar.gz: a91ec043fbcc3c279616f47e462f8574dbbcc355962c4534605749653e9f77983bdcd79455424c9a6d8c77a602afa3527eb3b50413510cbf6958b42c620e779a
|
data/lib/jekyll/converters/js.rb
CHANGED
@@ -11,7 +11,6 @@ module Jekyll
|
|
11
11
|
|
12
12
|
def associate_page(page)
|
13
13
|
@page = page
|
14
|
-
@site = @page.site
|
15
14
|
@source_map_page = JsSourceMapPage.new(@page)
|
16
15
|
end
|
17
16
|
|
@@ -31,19 +30,19 @@ module Jekyll
|
|
31
30
|
|
32
31
|
def load_paths
|
33
32
|
@load_paths ||= begin
|
34
|
-
paths = [Jekyll.sanitized_path(
|
35
|
-
paths += javascript_config['load_paths'].map { |load_path| File.expand_path(load_path) } rescue []
|
33
|
+
paths = [Jekyll.sanitized_path(site.source, javascript_dir)]
|
34
|
+
paths += javascript_config['load_paths'].map { |load_path| File.expand_path(load_path, site.source) } rescue []
|
36
35
|
|
37
36
|
if safe?
|
38
|
-
paths.map! { |path| Jekyll.sanitized_path(
|
37
|
+
paths.map! { |path| Jekyll.sanitized_path(site.source, path) }
|
39
38
|
end
|
40
39
|
|
41
|
-
Dir.chdir(
|
40
|
+
Dir.chdir(site.source) do
|
42
41
|
paths = paths.flat_map { |path| Dir.glob(path) }
|
43
42
|
|
44
43
|
paths.map! do |path|
|
45
44
|
if safe?
|
46
|
-
Jekyll.sanitized_path(
|
45
|
+
Jekyll.sanitized_path(site.source, path)
|
47
46
|
else
|
48
47
|
File.expand_path(path)
|
49
48
|
end
|
@@ -51,7 +50,7 @@ module Jekyll
|
|
51
50
|
end
|
52
51
|
|
53
52
|
paths.uniq!
|
54
|
-
paths <<
|
53
|
+
paths << site.theme.javascript_path if site.theme&.javascript_path
|
55
54
|
paths.select { |path| File.directory?(path) }
|
56
55
|
end
|
57
56
|
end
|
@@ -60,7 +59,7 @@ module Jekyll
|
|
60
59
|
ext =~ /^\.js$/i
|
61
60
|
end
|
62
61
|
|
63
|
-
def output_ext(ext)
|
62
|
+
def output_ext(ext = '')
|
64
63
|
'.js'
|
65
64
|
end
|
66
65
|
|
@@ -87,7 +86,7 @@ module Jekyll
|
|
87
86
|
uglified, source_map = Uglifier.new(config[:uglifer]).compile_with_map(insert_imports(content))
|
88
87
|
|
89
88
|
@source_map_page.source_map(source_map)
|
90
|
-
|
89
|
+
site.pages << @source_map_page
|
91
90
|
|
92
91
|
uglified
|
93
92
|
else
|
@@ -110,7 +109,7 @@ module Jekyll
|
|
110
109
|
elsif source_map_option.eql?(:always)
|
111
110
|
true
|
112
111
|
else
|
113
|
-
:development == source_map_option == Jekyll.env.to_sym
|
112
|
+
:development == source_map_option && source_map_option == Jekyll.env.to_sym
|
114
113
|
end
|
115
114
|
end
|
116
115
|
|
@@ -151,6 +150,10 @@ module Jekyll
|
|
151
150
|
content
|
152
151
|
end
|
153
152
|
|
153
|
+
def site
|
154
|
+
@site ||= @page.nil? ? Jekyll.sites.last : @page.site
|
155
|
+
end
|
156
|
+
|
154
157
|
def source_map_option
|
155
158
|
javascript_config.fetch('source_map', :always).to_sym
|
156
159
|
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: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Susco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uglifier
|