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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1829d0564075f121d22d27673117b2faec20a2eb81fa1d03d2d5a6dc51983b61
4
- data.tar.gz: 5acbbd812be621de4bde1efe22dde5cb28ecbe521358178541482ddc340ea1f8
3
+ metadata.gz: 118566f4df18bc53be9296785ff33401b7d33fc87cc25c25910abc1e870d88f8
4
+ data.tar.gz: 0ec3d27c4bbd8e874415fb3d11fdf609e5426b9b75c3562ebefa093777a5d708
5
5
  SHA512:
6
- metadata.gz: 8ff9da501bd8d9bde5064445b7b3073e59d7422042729f6c16539aacfa8ca7fdc61f519de397e71cdf8fa8408c3199299e6068f3413b13eaa5b6aa1730637c24
7
- data.tar.gz: dbf1210db9a30c009c72917b210785c754de843f3b536e0ff6f4c6aa82f6785cb5a415e949f26ebdee666586755f9e747e93bfe160e105f325ddf29b74199711
6
+ metadata.gz: d2fc90f1c9b2886bc7ee97f709b8b29f53dc3e569f4eeebf6c28e10d42b8806928b4c2c4f107017379c8518bfd81adbdb2cee552a64c9eecfe2ce724ea91a71b
7
+ data.tar.gz: 3d2a2ae73ec32ee4f7fe7fa720bc3a2221bb56924068d6c6fa0b4a4c0b357ad72c44051ff5ae38885b5d2b01787e244d5a18e86c019e48829de6e11ee2da4cab
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-uglify (1.0.0)
4
+ jekyll-uglify (1.0.2)
5
5
  uglifier (~> 4.2.0)
6
6
 
7
7
  GEM
@@ -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) }
@@ -7,19 +7,19 @@ require 'uglifier'
7
7
  module Jekyll
8
8
  module Uglify
9
9
  class Error < StandardError; end
10
- # Uglify all JS files in a given directory.
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 DIRECTORY [or]
15
- # bundle exec jekyll uglify DIR
14
+ # Syntax: jekyll uglify FILEPATH [ADDITIONAL_FILEPATHS] [or]
15
+ # bundle exec jekyll uglify FILEPATH [ADDITIONAL_FILEPATHS]
16
16
  # Arguments:
17
- # DIR directory in which JS should be uglified
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 DIRECTORY"
22
- c.description 'Uglifies JS files in a given directory. Ignores minified 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
- Dir.foreach(Dir.pwd + args[0]) do |file|
39
- next if file == '.' or file == '..' or file.include? '.min.js'
40
- filepath = Dir.pwd + args[0] + file
41
- output = Uglifier.compile(File.open(filepath, 'r'), config)
42
- File.open(filepath, 'w').write(output)
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
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Uglify
3
- VERSION = "1.0.2"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  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.2
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
Binary file