jekyll-uglify 1.0.2 → 1.1.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 +1 -1
- data/jekyll-uglify.gemspec +1 -1
- data/lib/jekyll/uglify.rb +21 -11
- data/lib/jekyll/uglify/version.rb +1 -1
- metadata +1 -2
- data/jekyll-uglify-1.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 118566f4df18bc53be9296785ff33401b7d33fc87cc25c25910abc1e870d88f8
|
4
|
+
data.tar.gz: 0ec3d27c4bbd8e874415fb3d11fdf609e5426b9b75c3562ebefa093777a5d708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2fc90f1c9b2886bc7ee97f709b8b29f53dc3e569f4eeebf6c28e10d42b8806928b4c2c4f107017379c8518bfd81adbdb2cee552a64c9eecfe2ce724ea91a71b
|
7
|
+
data.tar.gz: 3d2a2ae73ec32ee4f7fe7fa720bc3a2221bb56924068d6c6fa0b4a4c0b357ad72c44051ff5ae38885b5d2b01787e244d5a18e86c019e48829de6e11ee2da4cab
|
data/Gemfile.lock
CHANGED
data/jekyll-uglify.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
20
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) or f.match(/^jekyll-uglify-\d\.\d\.\d\.gem$/) }
|
22
22
|
end
|
23
23
|
spec.bindir = "exe"
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/lib/jekyll/uglify.rb
CHANGED
@@ -7,19 +7,19 @@ require 'uglifier'
|
|
7
7
|
module Jekyll
|
8
8
|
module Uglify
|
9
9
|
class Error < StandardError; end
|
10
|
-
# Uglify
|
10
|
+
# Uglify given JS files or directories.
|
11
11
|
# Ignores files with `.min.js` extensions.
|
12
12
|
# Gets Uglifier configuration settings from `_config.yml`
|
13
13
|
#
|
14
|
-
# Syntax: jekyll uglify
|
15
|
-
# bundle exec jekyll uglify
|
14
|
+
# Syntax: jekyll uglify FILEPATH [ADDITIONAL_FILEPATHS] [or]
|
15
|
+
# bundle exec jekyll uglify FILEPATH [ADDITIONAL_FILEPATHS]
|
16
16
|
# Arguments:
|
17
|
-
#
|
17
|
+
# FILEPATH path to file or directory to be uglified
|
18
18
|
class UglifyJS < Jekyll::Command
|
19
19
|
def self.init_with_program(prog)
|
20
20
|
prog.command(:uglify) do |c|
|
21
|
-
c.syntax "uglify
|
22
|
-
c.description 'Uglifies JS files
|
21
|
+
c.syntax "uglify FILEPATH [ADDITIONAL_FILEPATHS]"
|
22
|
+
c.description 'Uglifies given JS files or directories. Ignores minified files.'
|
23
23
|
|
24
24
|
c.action do |args, options|
|
25
25
|
config_raw = Jekyll.configuration()["jekyll-uglify"]
|
@@ -35,11 +35,21 @@ module Jekyll
|
|
35
35
|
config[k.to_sym] = v
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
args.each do |dir|
|
39
|
+
if !(dir.start_with? "/") then dir = "/" + dir end
|
40
|
+
if ((dir.end_with? ".js") && !(dir.end_with? ".min.js"))
|
41
|
+
filepath = Dir.pwd + dir
|
42
|
+
output = Uglifier.compile(File.open(filepath, 'r'), config)
|
43
|
+
File.open(filepath, 'w').write(output)
|
44
|
+
next
|
45
|
+
end
|
46
|
+
if !(dir.end_with? "/") then dir = dir + "/" end
|
47
|
+
Dir.foreach(Dir.pwd + dir) do |file|
|
48
|
+
next if file == '.' or file == '..' or file.include? '.min.js'
|
49
|
+
filepath = Dir.pwd + dir + file
|
50
|
+
output = Uglifier.compile(File.open(filepath, 'r'), config)
|
51
|
+
File.open(filepath, 'w').write(output)
|
52
|
+
end
|
43
53
|
end
|
44
54
|
end
|
45
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-uglify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Hofer
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- Rakefile
|
41
41
|
- bin/console
|
42
42
|
- bin/setup
|
43
|
-
- jekyll-uglify-1.0.1.gem
|
44
43
|
- jekyll-uglify.gemspec
|
45
44
|
- lib/jekyll/uglify.rb
|
46
45
|
- lib/jekyll/uglify/version.rb
|
data/jekyll-uglify-1.0.1.gem
DELETED
Binary file
|