jekyll-simple-assets 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +18 -14
- data/README.md +23 -8
- data/jekyll-simple-assets.gemspec +1 -1
- data/lib/jekyll-simple-assets.rb +30 -7
- data/lib/jekyll-simple-assets/content-hash.rb +4 -9
- data/lib/jekyll-simple-assets/esbuild.rb +9 -1
- data/lib/jekyll-simple-assets/terser.rb +100 -0
- data/lib/jekyll-simple-assets/version.rb +1 -1
- metadata +4 -4
- data/lib/jekyll-simple-assets/uglify.rb +0 -105
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a88ce587480260a2b882650c270bdc2109b2e85fb0171259b19134d8860c7e
|
4
|
+
data.tar.gz: 89d8af9b0ccc245da99c45e43369cfb636e978d862ad80a7bf01a595f2df75f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4104483ef4f80d627cab01fbc07799aae26849d4015ec03671b4cd74ed09728d39f7f2ffdcef339c2fc5a7ace21933b8218c200a34750216ac40234f3e7bb69
|
7
|
+
data.tar.gz: 144171dcfee48d6800d2796ed8eb14772ea82873914e5b53f616a206bfe1af28b73c6c2ba5b265edaae9de24931877f5f0a69cfd2ee5d6fce50939186a72f4fb
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-simple-assets (0.
|
4
|
+
jekyll-simple-assets (0.6.0)
|
5
5
|
css_parser
|
6
6
|
jekyll
|
7
|
+
terser
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -11,59 +12,62 @@ GEM
|
|
11
12
|
addressable (2.7.0)
|
12
13
|
public_suffix (>= 2.0.2, < 5.0)
|
13
14
|
colorator (1.1.0)
|
14
|
-
concurrent-ruby (1.1.
|
15
|
-
css_parser (1.
|
15
|
+
concurrent-ruby (1.1.8)
|
16
|
+
css_parser (1.9.0)
|
16
17
|
addressable
|
17
|
-
em-websocket (0.5.
|
18
|
+
em-websocket (0.5.2)
|
18
19
|
eventmachine (>= 0.12.9)
|
19
20
|
http_parser.rb (~> 0.6.0)
|
20
21
|
eventmachine (1.2.7)
|
21
|
-
|
22
|
+
execjs (2.7.0)
|
23
|
+
ffi (1.15.0)
|
22
24
|
forwardable-extended (2.6.0)
|
23
25
|
http_parser.rb (0.6.0)
|
24
|
-
i18n (1.8.
|
26
|
+
i18n (1.8.9)
|
25
27
|
concurrent-ruby (~> 1.0)
|
26
|
-
jekyll (4.
|
28
|
+
jekyll (4.2.0)
|
27
29
|
addressable (~> 2.4)
|
28
30
|
colorator (~> 1.0)
|
29
31
|
em-websocket (~> 0.5)
|
30
32
|
i18n (~> 1.0)
|
31
33
|
jekyll-sass-converter (~> 2.0)
|
32
34
|
jekyll-watch (~> 2.0)
|
33
|
-
kramdown (~> 2.
|
35
|
+
kramdown (~> 2.3)
|
34
36
|
kramdown-parser-gfm (~> 1.0)
|
35
37
|
liquid (~> 4.0)
|
36
38
|
mercenary (~> 0.4.0)
|
37
39
|
pathutil (~> 0.9)
|
38
40
|
rouge (~> 3.0)
|
39
41
|
safe_yaml (~> 1.0)
|
40
|
-
terminal-table (~>
|
42
|
+
terminal-table (~> 2.0)
|
41
43
|
jekyll-sass-converter (2.1.0)
|
42
44
|
sassc (> 2.0.1, < 3.0)
|
43
45
|
jekyll-watch (2.2.1)
|
44
46
|
listen (~> 3.0)
|
45
|
-
kramdown (2.
|
47
|
+
kramdown (2.3.1)
|
46
48
|
rexml
|
47
49
|
kramdown-parser-gfm (1.1.0)
|
48
50
|
kramdown (~> 2.0)
|
49
51
|
liquid (4.0.3)
|
50
|
-
listen (3.
|
52
|
+
listen (3.5.0)
|
51
53
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
52
54
|
rb-inotify (~> 0.9, >= 0.9.10)
|
53
55
|
mercenary (0.4.0)
|
54
56
|
pathutil (0.16.2)
|
55
57
|
forwardable-extended (~> 2.6)
|
56
|
-
public_suffix (4.0.
|
58
|
+
public_suffix (4.0.6)
|
57
59
|
rb-fsevent (0.10.4)
|
58
60
|
rb-inotify (0.10.1)
|
59
61
|
ffi (~> 1.0)
|
60
62
|
rexml (3.2.4)
|
61
|
-
rouge (3.
|
63
|
+
rouge (3.26.0)
|
62
64
|
safe_yaml (1.0.5)
|
63
65
|
sassc (2.4.0)
|
64
66
|
ffi (~> 1.9)
|
65
|
-
terminal-table (
|
67
|
+
terminal-table (2.0.0)
|
66
68
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
69
|
+
terser (1.1.3)
|
70
|
+
execjs (>= 0.3.0, < 3)
|
67
71
|
unicode-display_width (1.7.0)
|
68
72
|
|
69
73
|
PLATFORMS
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ Returns a base64 encoded md5 hash based on the contents of the path given.
|
|
23
23
|
|
24
24
|
Returns a relative url to the path given, with a hash based on the content of
|
25
25
|
the file as a query string.
|
26
|
+
Will link to a minified version of the file if possible.
|
26
27
|
|
27
28
|
```liquid
|
28
29
|
{% asset assets/js/app.js %}
|
@@ -58,6 +59,15 @@ Returns an md5 hash of the input string.
|
|
58
59
|
{{ 'some text' | md5 }}
|
59
60
|
```
|
60
61
|
|
62
|
+
#### uglify
|
63
|
+
|
64
|
+
Minifies javascript given as an input string (uses terser, and terser settings
|
65
|
+
even though the filter is called `uglify`
|
66
|
+
|
67
|
+
```liquid
|
68
|
+
{{ 'const foo = "bar"' | uglify }}
|
69
|
+
```
|
70
|
+
|
61
71
|
## Content hashes
|
62
72
|
|
63
73
|
How the content hashes work is by generating a placeholder string that is
|
@@ -111,11 +121,13 @@ installed.
|
|
111
121
|
|
112
122
|
## Javascript minification
|
113
123
|
|
114
|
-
The
|
124
|
+
The terser package is also included and will minify files if `terser_enabled`
|
115
125
|
is set to true in config.yml, or if JEKYLL_ENV is set to production. Any
|
116
|
-
options can be passed to
|
117
|
-
(see configuration for example
|
118
|
-
|
126
|
+
options can be passed to terser under the `terser` key in config.yml
|
127
|
+
(see configuration for example, or
|
128
|
+
[here](https://github.com/ahorek/terser-ruby) for detailed options).
|
129
|
+
Additionally you can set terser settings in the liquid frontmatter of a js file
|
130
|
+
in the same manner as in config.yml, also under the `terser` key.
|
119
131
|
|
120
132
|
## Configuration
|
121
133
|
|
@@ -126,6 +138,10 @@ simple_assets:
|
|
126
138
|
# default: false
|
127
139
|
hashing_enabled: true
|
128
140
|
|
141
|
+
# If set to true, source maps will be generated for javascript
|
142
|
+
# default: false
|
143
|
+
source_maps_enabled: true
|
144
|
+
|
129
145
|
# The length of the content hashes generated.
|
130
146
|
# default: 16
|
131
147
|
hash_length: 8
|
@@ -154,10 +170,9 @@ simple_assets:
|
|
154
170
|
# Set to true to enable
|
155
171
|
bundle: true
|
156
172
|
|
157
|
-
# Options for javascript minification with
|
158
|
-
|
159
|
-
# any options for
|
160
|
-
harmony: true
|
173
|
+
# Options for javascript minification with terser
|
174
|
+
terser:
|
175
|
+
# any options for terser can be put here and will be passed to it
|
161
176
|
output:
|
162
177
|
ascii_only: true
|
163
178
|
```
|
data/lib/jekyll-simple-assets.rb
CHANGED
@@ -8,7 +8,7 @@ require 'shellwords'
|
|
8
8
|
require 'jekyll-simple-assets/content-hash'
|
9
9
|
require 'jekyll-simple-assets/critical'
|
10
10
|
require 'jekyll-simple-assets/esbuild'
|
11
|
-
require 'jekyll-simple-assets/
|
11
|
+
require 'jekyll-simple-assets/terser'
|
12
12
|
|
13
13
|
module Jekyll
|
14
14
|
module SimpleAssets
|
@@ -38,8 +38,12 @@ module Jekyll
|
|
38
38
|
@@esbuild_config_file ||= file
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.
|
42
|
-
config['
|
41
|
+
def self.terser_enabled?
|
42
|
+
config['terser_enabled'] || ENV['JEKYLL_ENV'] == 'production'
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.source_maps_enabled?
|
46
|
+
config['source_maps_enabled']
|
43
47
|
end
|
44
48
|
|
45
49
|
module SimpleAssetsFilters
|
@@ -121,20 +125,39 @@ Jekyll::Hooks.register :site, :post_render, priority: :low do |site, payload|
|
|
121
125
|
end
|
122
126
|
|
123
127
|
potential_pages.each do |doc|
|
124
|
-
|
128
|
+
page_path = doc.path.sub("#{ site.config['source'] }/", '')
|
129
|
+
|
130
|
+
if Jekyll::SimpleAssets::page_assets_map[page_path]
|
131
|
+
doc.output = Jekyll::SimpleAssets::replace_placeholders_for_path(page_path, doc.output)
|
132
|
+
end
|
133
|
+
|
134
|
+
if doc.extname =~ /^\.(j|t)s$/i and Jekyll::SimpleAssets::should_minify_file?(doc)
|
135
|
+
min_path, minified = Jekyll::SimpleAssets::minify_file(doc)
|
136
|
+
|
137
|
+
if min_path and Jekyll::SimpleAssets::page_assets_map[page_path]
|
138
|
+
minified = Jekyll::SimpleAssets::replace_placeholders_for_path(page_path, minified)
|
139
|
+
end
|
140
|
+
|
141
|
+
File.write(File.join(Jekyll::SimpleAssets::site.config['destination'], min_path), minified)
|
142
|
+
end
|
125
143
|
end
|
126
144
|
end
|
127
145
|
end
|
128
146
|
|
129
147
|
Jekyll::Hooks.register :pages, :post_render do |page, payload|
|
130
|
-
next unless Jekyll::SimpleAssets::esbuild_enabled?
|
131
|
-
|
132
148
|
unless Jekyll::SimpleAssets::esbuild_config_file
|
133
149
|
Jekyll::SimpleAssets::generate_esbuild_config_file()
|
134
150
|
end
|
135
151
|
|
136
152
|
if page.extname =~ /^\.(j|t)s$/i
|
137
|
-
|
153
|
+
if Jekyll::SimpleAssets::esbuild_enabled?
|
154
|
+
Jekyll::SimpleAssets::esbuild_bundle_file(page, payload, Jekyll::SimpleAssets::esbuild_config_file.path)
|
155
|
+
end
|
156
|
+
|
157
|
+
if Jekyll::SimpleAssets::should_minify_file?(page)
|
158
|
+
min_path = page.path.sub(/\.(j|t)s$/i, '.min.js')
|
159
|
+
File.write(File.join(Jekyll::SimpleAssets::site.config['destination'], min_path), '')
|
160
|
+
end
|
138
161
|
end
|
139
162
|
end
|
140
163
|
|
@@ -155,7 +155,10 @@ def self.replace_placeholders_for_path (page_path, input)
|
|
155
155
|
replacement = SimpleAssets::asset_contenthash_map[asset_path]
|
156
156
|
|
157
157
|
if type == 'path'
|
158
|
-
|
158
|
+
min_path = asset_path.sub(/\.([^\.]*?)$/, '.min.\1')
|
159
|
+
url = (File.file? File.join(SimpleAssets::site.config['destination'], min_path)) ? min_path : asset_path
|
160
|
+
|
161
|
+
replacement = "#{ url }?v=#{ replacement }"
|
159
162
|
|
160
163
|
replacement = SimpleAssets::relative_url(replacement)
|
161
164
|
end
|
@@ -170,14 +173,6 @@ def self.replace_placeholders_for_path (page_path, input)
|
|
170
173
|
output
|
171
174
|
end
|
172
175
|
|
173
|
-
def self.replace_placeholders_for_asset (doc, site)
|
174
|
-
page_path = doc.path.sub("#{ site.config['source'] }/", '')
|
175
|
-
|
176
|
-
return unless SimpleAssets::page_assets_map[page_path]
|
177
|
-
|
178
|
-
doc.output = SimpleAssets::replace_placeholders_for_path(page_path, doc.output)
|
179
|
-
end
|
180
|
-
|
181
176
|
|
182
177
|
end
|
183
178
|
end
|
@@ -50,7 +50,15 @@ def self.esbuild_bundle_file (page, payload, config_path)
|
|
50
50
|
bundle_cmd = "npx esbuild --bundle --tsconfig=#{ config_path }"
|
51
51
|
|
52
52
|
if page.data['esbuild_flags']
|
53
|
-
bundle_cmd
|
53
|
+
bundle_cmd += ' ' + page.data['esbuild_flags']
|
54
|
+
end
|
55
|
+
|
56
|
+
node_env = '--define:process.env.NODE_ENV="' + (ENV['JEKYLL_ENV'] != 'production' ? "'development'" : "'production'") + '"'
|
57
|
+
|
58
|
+
bundle_cmd += ' ' + node_env + " --sourcefile=#{ page.path[/[^\/]*$/] }"
|
59
|
+
|
60
|
+
if SimpleAssets::source_maps_enabled?
|
61
|
+
bundle_cmd += ' ' + '--sourcemap=inline'
|
54
62
|
end
|
55
63
|
|
56
64
|
dir = File.dirname(page.path)
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'terser'
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
|
6
|
+
module SimpleAssets
|
7
|
+
def self.symbolize_keys (hash)
|
8
|
+
return {} if hash.nil?
|
9
|
+
|
10
|
+
hash.inject({}) do |result, (key, value)|
|
11
|
+
|
12
|
+
new_key = case key
|
13
|
+
when String then key.to_sym
|
14
|
+
else key
|
15
|
+
end
|
16
|
+
new_value = case value
|
17
|
+
when Hash then symbolize_keys(value)
|
18
|
+
else value
|
19
|
+
end
|
20
|
+
|
21
|
+
if new_value.is_a?(String) and new_value.match(/^\/.*\/$/)
|
22
|
+
new_value = /#{ Regexp.quote(new_value[1..-2]) }/
|
23
|
+
end
|
24
|
+
|
25
|
+
result[new_key] = new_value
|
26
|
+
|
27
|
+
result
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.merge_recursively(a, b)
|
32
|
+
a.merge(b) {|key, a_item, b_item| SimpleAssets::merge_recursively(a_item, b_item) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.should_minify_file? (page)
|
36
|
+
return false unless page.respond_to? :output
|
37
|
+
return false unless SimpleAssets::terser_enabled?
|
38
|
+
return false if page.data['do_not_compress'] == true
|
39
|
+
return true
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.minify_file (page)
|
43
|
+
return unless SimpleAssets::should_minify_file?(page)
|
44
|
+
|
45
|
+
site_config = symbolize_keys(SimpleAssets::site.config['simple_assets']['terser'])
|
46
|
+
page_config = symbolize_keys(page.data['terser'])
|
47
|
+
|
48
|
+
config = SimpleAssets::merge_recursively(site_config || {}, page_config || {})
|
49
|
+
|
50
|
+
map_path = page.path + '.map'
|
51
|
+
if SimpleAssets::source_maps_enabled?
|
52
|
+
config = SimpleAssets::merge_recursively(config, {
|
53
|
+
:source_map => { :filename => page.path[/[^\/]*$/], :url => true },
|
54
|
+
})
|
55
|
+
|
56
|
+
minified, source_map = Terser.new(config).compile_with_map(page.output)
|
57
|
+
else
|
58
|
+
minified = Terser.new(config).compile(page.output)
|
59
|
+
end
|
60
|
+
|
61
|
+
min_path = page.path.sub(/\.(j|t)s$/i, '.min.js')
|
62
|
+
Jekyll.logger.info("SimpleAssets:", 'minified: ' + min_path)
|
63
|
+
|
64
|
+
if source_map
|
65
|
+
File.write(File.join(SimpleAssets::site.config['destination'], map_path), source_map)
|
66
|
+
minified = minified.gsub(/^\/\/#\s*?source(Mapping)?URL=.*$/, '')
|
67
|
+
minified += "\n//# sourceMappingURL=#{ SimpleAssets::relative_url(map_path) }"
|
68
|
+
|
69
|
+
Jekyll.logger.debug("SimpleAssets:", 'created source map: ' + map_path)
|
70
|
+
|
71
|
+
SimpleAssets::site.config['keep_files'] << map_path
|
72
|
+
end
|
73
|
+
|
74
|
+
if SimpleAssets::page_assets_map[page.path]
|
75
|
+
SimpleAssets::page_assets_map[min_path] = SimpleAssets::page_assets_map[page.path]
|
76
|
+
end
|
77
|
+
|
78
|
+
SimpleAssets::site.config['keep_files'] << min_path
|
79
|
+
|
80
|
+
return min_path, minified
|
81
|
+
end
|
82
|
+
|
83
|
+
module UglifyFilter
|
84
|
+
def uglify (input)
|
85
|
+
return if input.nil?
|
86
|
+
|
87
|
+
return input.split('\n').join('\\\n') unless SimpleAssets::terser_enabled?
|
88
|
+
|
89
|
+
config = @context.registers[:site].config['simple_assets']
|
90
|
+
|
91
|
+
terser_config = SimpleAssets::symbolize_keys(config['terser'])
|
92
|
+
|
93
|
+
Terser.new(terser_config).compile(input)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
Liquid::Template.register_filter(Jekyll::SimpleAssets::UglifyFilter)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-simple-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sophie Askew
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: terser
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -83,7 +83,7 @@ files:
|
|
83
83
|
- lib/jekyll-simple-assets/content-hash.rb
|
84
84
|
- lib/jekyll-simple-assets/critical.rb
|
85
85
|
- lib/jekyll-simple-assets/esbuild.rb
|
86
|
-
- lib/jekyll-simple-assets/
|
86
|
+
- lib/jekyll-simple-assets/terser.rb
|
87
87
|
- lib/jekyll-simple-assets/version.rb
|
88
88
|
homepage: https://github.com/syldexiahime/jekyll-simple-assets
|
89
89
|
licenses:
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'uglifier'
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
|
5
|
-
module SimpleAssets
|
6
|
-
def self.symbolize_keys (hash)
|
7
|
-
return {} if hash.nil?
|
8
|
-
|
9
|
-
hash.inject({}) do |result, (key, value)|
|
10
|
-
|
11
|
-
new_key = case key
|
12
|
-
when String then key.to_sym
|
13
|
-
else key
|
14
|
-
end
|
15
|
-
new_value = case value
|
16
|
-
when Hash then symbolize_keys(value)
|
17
|
-
else value
|
18
|
-
end
|
19
|
-
|
20
|
-
if new_value.is_a?(String) and new_value.match(/^\/.*\/$/)
|
21
|
-
new_value = /#{ Regexp.quote(new_value[1..-2]) }/
|
22
|
-
end
|
23
|
-
|
24
|
-
result[new_key] = new_value
|
25
|
-
|
26
|
-
result
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
module UglifyFilter
|
31
|
-
def uglify (input)
|
32
|
-
return if input.nil?
|
33
|
-
|
34
|
-
return input.split('\n').join('\\\n') unless SimpleAssets::uglifier_enabled?
|
35
|
-
|
36
|
-
config = @context.registers[:site].config['simple_assets']
|
37
|
-
|
38
|
-
uglifier_config = SimpleAssets::symbolize_keys(config['uglifier'])
|
39
|
-
|
40
|
-
Uglifier.new(uglifier_config).compile input
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
module Converters
|
46
|
-
|
47
|
-
class SimpleAssetsUglify < Converter
|
48
|
-
safe true
|
49
|
-
priority :lowest
|
50
|
-
|
51
|
-
def initialize (config={})
|
52
|
-
super(config)
|
53
|
-
|
54
|
-
@config = SimpleAssets::symbolize_keys(config['simple_assets']['uglifier'])
|
55
|
-
|
56
|
-
Jekyll::Hooks.register :pages, :pre_render do |page|
|
57
|
-
ext = '.' + page.path.split('.').last
|
58
|
-
|
59
|
-
if matches(ext)
|
60
|
-
@meta = SimpleAssets::symbolize_keys(page.data['uglifier'])
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
Jekyll::Hooks.register :pages, :post_render do |page|
|
65
|
-
ext = '.' + page.path.split('.').last
|
66
|
-
|
67
|
-
if matches(ext)
|
68
|
-
@meta = nil
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def merge_recursively(a, b)
|
74
|
-
a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) }
|
75
|
-
end
|
76
|
-
|
77
|
-
def get_config ()
|
78
|
-
merge_recursively(@config || {}, @meta || {})
|
79
|
-
end
|
80
|
-
|
81
|
-
def matches (ext)
|
82
|
-
return nil unless ext
|
83
|
-
|
84
|
-
ext.downcase == '.js'
|
85
|
-
end
|
86
|
-
|
87
|
-
def output_ext (ext)
|
88
|
-
'.js'
|
89
|
-
end
|
90
|
-
|
91
|
-
def convert (content)
|
92
|
-
return content unless SimpleAssets::uglifier_enabled?
|
93
|
-
|
94
|
-
config = get_config
|
95
|
-
|
96
|
-
return content if config[:do_not_compress] == true
|
97
|
-
|
98
|
-
Uglifier.new(config).compile content
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
Liquid::Template.register_filter(Jekyll::SimpleAssets::UglifyFilter)
|