jekyll-jsminify 0.2.1 → 0.3.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 +4 -4
- data/lib/jekyll-jsminify.rb +36 -53
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72ff05f938eed9373c60a5e7dec47ee075aba844
|
4
|
+
data.tar.gz: a7772b058e5a05ce7623900941b9d5c7e6e320bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d29568cf80f176ff54b5f3ce866e386197bff2af9560c6592f3a501a72b2bda309be97c0034b694e20d3663bb3fe3368596fc31cf17a4570ffaa22bcdcda5e5
|
7
|
+
data.tar.gz: 764977576e972929902a350aa8d90be0c21658e9931667510fc2081c51a37e4cec88861a41f816d6fc83614a58fc34e04aefc6f8b4ed327c09863745201ee63f
|
data/lib/jekyll-jsminify.rb
CHANGED
@@ -4,8 +4,8 @@ module Jekyll
|
|
4
4
|
module Converters
|
5
5
|
module Minify
|
6
6
|
def self.symbolize_keys(hash)
|
7
|
-
return {
|
8
|
-
hash.inject({})
|
7
|
+
return {} if hash.nil?
|
8
|
+
hash.inject({}) do |result, (key, value)|
|
9
9
|
new_key = case key
|
10
10
|
when String then key.to_sym
|
11
11
|
else key
|
@@ -16,7 +16,7 @@ module Jekyll
|
|
16
16
|
end
|
17
17
|
result[new_key] = new_value
|
18
18
|
result
|
19
|
-
|
19
|
+
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -24,30 +24,28 @@ end
|
|
24
24
|
|
25
25
|
module Jekyll
|
26
26
|
module Converters
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
priority :lowest
|
27
|
+
class JSMinify < Converter
|
28
|
+
safe true
|
29
|
+
priority :lowest
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
def initialize(config={})
|
32
|
+
config['jsminify'] = Minify::symbolize_keys(config['jsminify'])
|
33
|
+
@config = config.dup
|
34
|
+
end
|
36
35
|
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
def matches(ext)
|
38
|
+
ext.downcase == '.js'
|
39
|
+
end
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def output_ext(ext)
|
42
|
+
'.js'
|
43
|
+
end
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
45
|
+
def convert(content)
|
46
|
+
config = @config['jsminify'] || {}
|
47
|
+
return content if config[:do_not_compress] == true
|
48
|
+
Uglifier.new(config).compile content
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
@@ -55,42 +53,27 @@ end
|
|
55
53
|
|
56
54
|
module Jekyll
|
57
55
|
module Converters
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
def initialize(config={})
|
64
|
-
config['jsminify'] = Minify::symbolize_keys(config['jsminify'])
|
65
|
-
@config = config.dup
|
66
|
-
end
|
56
|
+
class CSMinify < CoffeeScript
|
57
|
+
def initialize(config = {})
|
58
|
+
config['jsminify'] = Minify::symbolize_keys(config['jsminify'])
|
59
|
+
@config = config.dup
|
60
|
+
end
|
67
61
|
|
68
|
-
|
69
|
-
|
70
|
-
|
62
|
+
def matches(ext)
|
63
|
+
ext.downcase == '.coffee'
|
64
|
+
end
|
71
65
|
|
72
|
-
|
73
|
-
|
74
|
-
|
66
|
+
def output_ext(ext)
|
67
|
+
'.js'
|
68
|
+
end
|
75
69
|
|
76
|
-
|
77
|
-
|
70
|
+
def convert(content)
|
71
|
+
config = @config['jsminify'] || {}
|
78
72
|
|
79
|
-
|
80
|
-
|
81
|
-
# some timing issue?
|
82
|
-
begin
|
83
|
-
return super if config[:do_not_compress] == true
|
84
|
-
rescue
|
85
|
-
return content if config[:do_not_compress] == true
|
86
|
-
end
|
73
|
+
js_content = super
|
74
|
+
return js_content if config[:do_not_compress] == true
|
87
75
|
|
88
|
-
|
89
|
-
Uglifier.new(config).compile super
|
90
|
-
rescue
|
91
|
-
Uglifier.new(config).compile content
|
92
|
-
end
|
93
|
-
end
|
76
|
+
Uglifier.new(config).compile(js_content)
|
94
77
|
end
|
95
78
|
end
|
96
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-jsminify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uglifier
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jekyll-coffeescript
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
122
|
version: '0'
|
109
123
|
requirements: []
|
110
124
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.4.5.1
|
112
126
|
signing_key:
|
113
127
|
specification_version: 4
|
114
128
|
summary: A JavaScript and CoffeeScript minifier for Jekyll.
|