jekyll-press 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1bd7160f8d31f14c8c2e62d915655d389f5b544f
4
+ data.tar.gz: df5fb4f1ec895188010a10b204eb03246b2bb421
5
+ SHA512:
6
+ metadata.gz: 802cc5bf4aa2fc105ad4988dbfa30841f3d2e90365e751fcbe5519e7ae2882aac24488dd1d3f9977f0c3938c4112bd3c7242f994266c782b00208744e621b44d
7
+ data.tar.gz: 736e6f8890c3a9a8fd8a218b46742ee6c632ec8f7412853e953f368980ea2dba13edd7a0d1209b2b967d6c7c9e2ecdfbc4b990c012423ef3ddca6497eef7a118
data/.gitignore CHANGED
@@ -1,17 +1,17 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in jekyll-press.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-press.gemspec
4
+ gemspec
data/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2012 Stereobooster
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1
+ Copyright (c) 2012 Stereobooster
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/Readme.md CHANGED
@@ -1,70 +1,71 @@
1
- # jekyll-press
2
- Minifier plugin for jekyll. Minifies all html, js, css files. Simple just drop it in solution. No Java required.
3
-
4
- This plugin:
5
- - compress html with the help of html_press
6
- - compress JavaScript files with the help of uglifier
7
- - compress css files with the help of css_press
8
-
9
- ## Installation
10
-
11
- ### Bundler
12
- Add this line to your application's `Gemfile`:
13
- ```ruby
14
- gem 'jekyll-press'
15
- ```
16
-
17
- And then execute:
18
- ```bash
19
- $ bundle
20
- ```
21
-
22
- ### Standalone
23
- Execute:
24
- ```bash
25
- $ gem install jekyll-press
26
- ```
27
-
28
- ## Usage
29
-
30
- ### With Bundler (recomended)
31
- Create the following plugin in your projects _plugins directory.
32
-
33
- ```ruby
34
- # _plugins/bundler.rb
35
- require "rubygems"
36
- require "bundler/setup"
37
- Bundler.require(:default)
38
- ```
39
-
40
- This will automatically require all of the gems specified in your Gemfile.
41
-
42
- ### Standalone
43
- Create the following plugin in your projects _plugins directory.
44
-
45
- ```ruby
46
- # _plugins/jekyll-press-plugin.rb
47
- require 'jekyll-press'
48
- ```
49
-
50
- ### Settings
51
- If you want to exclude some jekyll pages from processing (for example `atom.xml`) you can add following to the `_config.yml`:
52
-
53
- ```yaml
54
- jekyll-press:
55
- exclude: 'atom.xml'
56
- ```
57
-
58
- `exclude` can be file name, glob pattern or array of file names and glob patterns.
59
-
60
- ## TODO
61
- - Minify JPEGs with [`jpegtran`](/cmer/jpegtran) or `smush.it` ([smusher](/grosser/smusher))
62
- - Minify PNGs with [`optipng`](/martinkozak/optipng) or `smush.it` ([smusher](/grosser/smusher))
63
- - Auto CSS sprites (for example [sprite factory](/jakesgordon/sprite-factory/))
64
-
65
- ## Contributing
66
- 1. Fork it
67
- 2. Create your feature branch (`git checkout -b my-new-feature`)
68
- 3. Commit your changes (`git commit -am 'Added some feature'`)
69
- 4. Push to the branch (`git push origin my-new-feature`)
70
- 5. Create new Pull Request
1
+ # jekyll-press
2
+ Minifier plugin for jekyll. Minifies all html, js, css files. Simple just drop it in solution. No Java required.
3
+
4
+ This plugin:
5
+ - compress html with the help of html_press
6
+ - compress JavaScript files with the help of uglifier
7
+ - compress css files with the help of css_press
8
+
9
+ ## Installation
10
+
11
+ ### Bundler
12
+ Add this line to your application's `Gemfile`:
13
+ ```ruby
14
+ gem 'jekyll-press'
15
+ ```
16
+
17
+ And then execute:
18
+ ```bash
19
+ $ bundle
20
+ ```
21
+
22
+ ### Standalone
23
+ Execute:
24
+ ```bash
25
+ $ gem install jekyll-press
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ### With Bundler (recomended)
31
+ Create the following plugin in your projects _plugins directory.
32
+
33
+ ```ruby
34
+ # _plugins/bundler.rb
35
+ require "rubygems"
36
+ require "bundler/setup"
37
+ Bundler.require(:default)
38
+ ```
39
+
40
+ This will automatically require all of the gems specified in your Gemfile.
41
+
42
+ ### Standalone
43
+ Create the following plugin in your projects _plugins directory.
44
+
45
+ ```ruby
46
+ # _plugins/jekyll-press-plugin.rb
47
+ require 'jekyll-press'
48
+ ```
49
+
50
+ ### Settings
51
+
52
+ ```yaml
53
+ jekyll-press:
54
+ exclude: 'atom.xml' # Exclude files from processing - file name, glob pattern or array of file names and glob patterns
55
+ js_options: {} # js minifier options
56
+ css_options: {} # css minifier options
57
+ html_options: {} # html minifier options
58
+ ```
59
+
60
+ ## TODO
61
+ - add test: run against simple jekyll site and check if there is no errors
62
+ - Minify JPEGs with [`jpegtran`](/cmer/jpegtran) or `smush.it` ([smusher](/grosser/smusher))
63
+ - Minify PNGs with [`optipng`](/martinkozak/optipng) or `smush.it` ([smusher](/grosser/smusher))
64
+ - Auto CSS sprites (for example [sprite factory](/jakesgordon/sprite-factory/))
65
+
66
+ ## Contributing
67
+ 1. Fork it
68
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
69
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
70
+ 4. Push to the branch (`git push origin my-new-feature`)
71
+ 5. Create new Pull Request
@@ -1,23 +1,25 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/jekyll-press/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["sterebooster"]
6
- gem.email = ["stereobooster@gmail.com"]
7
- gem.description = %q{Minifier plugin for jekyll. Minifies all html, js, css files. Simple just drop it in solution. No Java required}
8
- gem.summary = %q{Minifier plugin for jekyll. This plugin compress html with the help of html_press, compress JavaScript files with the help of uglifier, compress css files with the help of css_press}
9
- gem.homepage = "http://github.com/stereobooster/jekyl-press"
10
- gem.license = "MIT"
11
-
12
- gem.files = `git ls-files`.split($\)
13
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
- gem.name = "jekyll-press"
16
- gem.require_paths = ["lib"]
17
- gem.version = Jekyll::Press::VERSION
18
-
19
- gem.add_dependency 'jekyll'
20
- gem.add_dependency "html_press", ">= 0.8.0"
21
- gem.add_dependency "multi_css", ">= 0.1.0"
22
- gem.add_dependency "uglifier"
23
- end
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/jekyll-press/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["sterebooster"]
6
+ gem.email = ["stereobooster@gmail.com"]
7
+ gem.description = %q{Minifier plugin for jekyll. Minifies all html, js, css files. Simple just drop it in solution. No Java required}
8
+ gem.summary = %q{Minifier plugin for jekyll. This plugin compress html with the help of html_press, compress JavaScript files with the help of uglifier, compress css files with the help of css_press}
9
+ gem.homepage = "http://github.com/stereobooster/jekyll-press"
10
+ gem.license = "MIT"
11
+
12
+ gem.files = `git ls-files`.split($\)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.name = "jekyll-press"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = Jekyll::Press::VERSION
18
+
19
+ gem.add_dependency "jekyll"
20
+ gem.add_dependency "html_press", ">= 0.8.2"
21
+ gem.add_dependency "multi_css", ">= 0.1.0"
22
+ gem.add_dependency "multi_js", ">= 0.1.0"
23
+
24
+ gem.add_development_dependency "rake"
25
+ end
@@ -1,111 +1,111 @@
1
- require "jekyll-press/version"
2
-
3
- require 'html_press'
4
- require 'multi_css'
5
- require 'uglifier'
6
-
7
- module Jekyll
8
- module Compressor
9
- def exclude?(dest, dest_path)
10
- res = false
11
- file_name = dest_path.slice(dest.length+1..dest_path.length)
12
- exclude = @site.config['jekyll-press'] && @site.config['jekyll-press']['exclude']
13
- if exclude
14
- if exclude.is_a? String
15
- exclude = [exclude]
16
- end
17
- exclude.each do |e|
18
- if e == file_name || File.fnmatch(e, file_name)
19
- res = true
20
- break
21
- end
22
- end
23
- end
24
- res
25
- end
26
-
27
- def output_file(dest, content)
28
- FileUtils.mkdir_p(File.dirname(dest))
29
- File.open(dest, 'w') do |f|
30
- f.write(content)
31
- end
32
- end
33
-
34
- def output_html(path, content)
35
- output_file(path, HtmlPress.press(content))
36
- end
37
-
38
- def output_js(path, content)
39
- output_file(path, Uglifier.new.compile(content))
40
- rescue Uglifier::Error => e
41
- warn "Warning: parse error in #{path}. Don't panic - copying initial file"
42
- warn "Details: #{e.message.strip}"
43
- output_file(path, content)
44
- end
45
-
46
- def output_css(path, content)
47
- output_file(path, MultiCss.min(content))
48
- rescue MultiCss::ParseError => e
49
- warn "Warning: parse error in #{path}. Don't panic - copying initial file"
50
- warn "Details: #{e.message.strip}"
51
- output_file(path, content)
52
- end
53
- end
54
-
55
- class Post
56
- include Compressor
57
-
58
- def write(dest)
59
- dest_path = destination(dest)
60
- output_html(dest_path, output)
61
- end
62
- end
63
-
64
- class Page
65
- include Compressor
66
-
67
- def write(dest)
68
- dest_path = destination(dest)
69
- if exclude?(dest, dest_path)
70
- output_file(dest_path, output)
71
- else
72
- output_html(dest_path, output)
73
- end
74
- end
75
- end
76
-
77
- class StaticFile
78
- include Compressor
79
-
80
- def copy_file(path, dest_path)
81
- FileUtils.mkdir_p(File.dirname(dest_path))
82
- FileUtils.cp(path, dest_path)
83
- end
84
-
85
- def write(dest)
86
- dest_path = destination(dest)
87
-
88
- return false if File.exist?(dest_path) and !modified?
89
- @@mtimes[path] = mtime
90
-
91
- case File.extname(dest_path)
92
- when '.js'
93
- if dest_path =~ /.min.js$/
94
- copy_file(path, dest_path)
95
- else
96
- output_js(dest_path, File.read(path))
97
- end
98
- when '.css'
99
- if dest_path =~ /.min.css$/
100
- copy_file(path, dest_path)
101
- else
102
- output_css(dest_path, File.read(path))
103
- end
104
- else
105
- copy_file(path, dest_path)
106
- end
107
-
108
- true
109
- end
110
- end
1
+ require "jekyll-press/version"
2
+
3
+ require 'html_press'
4
+ require 'multi_css'
5
+ require 'multi_js'
6
+
7
+ module Jekyll
8
+ module Compressor
9
+ def exclude?(dest, dest_path)
10
+ res = false
11
+ file_name = dest_path.slice(dest.length+1..dest_path.length)
12
+ exclude = @site.config['jekyll-press'] && @site.config['jekyll-press']['exclude']
13
+ if exclude
14
+ if exclude.is_a? String
15
+ exclude = [exclude]
16
+ end
17
+ exclude.each do |e|
18
+ if e == file_name || File.fnmatch(e, file_name)
19
+ res = true
20
+ break
21
+ end
22
+ end
23
+ end
24
+ res
25
+ end
26
+
27
+ def output_file(dest, content)
28
+ FileUtils.mkdir_p(File.dirname(dest))
29
+ File.open(dest, 'w') do |f|
30
+ f.write(content)
31
+ end
32
+ end
33
+
34
+ def output_html(path, content)
35
+ output_file(path, HtmlPress.press(content, @site.config['jekyll-press'] && @site.config['jekyll-press']['html_options'] || {}))
36
+ end
37
+
38
+ def output_js(path, content)
39
+ output_file(path, MultiJs.compile(content, @site.config['jekyll-press'] && @site.config['jekyll-press']['js_options'] || {}))
40
+ rescue MultiJs::ParseError => e
41
+ warn "Warning: parse error in #{path}. Don't panic - copying initial file"
42
+ warn "Details: #{e.message.strip}"
43
+ output_file(path, content)
44
+ end
45
+
46
+ def output_css(path, content)
47
+ output_file(path, MultiCss.min(content, @site.config['jekyll-press'] && @site.config['jekyll-press']['css_options'] || {}))
48
+ rescue MultiCss::ParseError => e
49
+ warn "Warning: parse error in #{path}. Don't panic - copying initial file"
50
+ warn "Details: #{e.message.strip}"
51
+ output_file(path, content)
52
+ end
53
+ end
54
+
55
+ class Post
56
+ include Compressor
57
+
58
+ def write(dest)
59
+ dest_path = destination(dest)
60
+ output_html(dest_path, output)
61
+ end
62
+ end
63
+
64
+ class Page
65
+ include Compressor
66
+
67
+ def write(dest)
68
+ dest_path = destination(dest)
69
+ if exclude?(dest, dest_path)
70
+ output_file(dest_path, output)
71
+ else
72
+ output_html(dest_path, output)
73
+ end
74
+ end
75
+ end
76
+
77
+ class StaticFile
78
+ include Compressor
79
+
80
+ def copy_file(path, dest_path)
81
+ FileUtils.mkdir_p(File.dirname(dest_path))
82
+ FileUtils.cp(path, dest_path)
83
+ end
84
+
85
+ def write(dest)
86
+ dest_path = destination(dest)
87
+
88
+ return false if File.exist?(dest_path) and !modified?
89
+ @@mtimes[path] = mtime
90
+
91
+ case File.extname(dest_path)
92
+ when '.js'
93
+ if dest_path =~ /.min.js$/
94
+ copy_file(path, dest_path)
95
+ else
96
+ output_js(dest_path, File.read(path))
97
+ end
98
+ when '.css'
99
+ if dest_path =~ /.min.css$/
100
+ copy_file(path, dest_path)
101
+ else
102
+ output_css(dest_path, File.read(path))
103
+ end
104
+ else
105
+ copy_file(path, dest_path)
106
+ end
107
+
108
+ true
109
+ end
110
+ end
111
111
  end
@@ -1,5 +1,5 @@
1
- module Jekyll
2
- module Press
3
- VERSION = "0.2.0"
4
- end
5
- end
1
+ module Jekyll
2
+ module Press
3
+ VERSION = "0.2.1"
4
+ end
5
+ end
metadata CHANGED
@@ -1,78 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-press
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - sterebooster
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
11
+ date: 2013-06-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: jekyll
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: html_press
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 0.8.0
33
+ version: 0.8.2
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 0.8.0
40
+ version: 0.8.2
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: multi_css
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.1.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.1.0
62
55
  - !ruby/object:Gem::Dependency
63
- name: uglifier
56
+ name: multi_js
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
- version: '0'
61
+ version: 0.1.0
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
76
81
  - !ruby/object:Gem::Version
77
82
  version: '0'
78
83
  description: Minifier plugin for jekyll. Minifies all html, js, css files. Simple
@@ -91,30 +96,29 @@ files:
91
96
  - jekyll-press.gemspec
92
97
  - lib/jekyll-press.rb
93
98
  - lib/jekyll-press/version.rb
94
- homepage: http://github.com/stereobooster/jekyl-press
99
+ homepage: http://github.com/stereobooster/jekyll-press
95
100
  licenses:
96
101
  - MIT
102
+ metadata: {}
97
103
  post_install_message:
98
104
  rdoc_options: []
99
105
  require_paths:
100
106
  - lib
101
107
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
108
  requirements:
104
- - - ! '>='
109
+ - - '>='
105
110
  - !ruby/object:Gem::Version
106
111
  version: '0'
107
112
  required_rubygems_version: !ruby/object:Gem::Requirement
108
- none: false
109
113
  requirements:
110
- - - ! '>='
114
+ - - '>='
111
115
  - !ruby/object:Gem::Version
112
116
  version: '0'
113
117
  requirements: []
114
118
  rubyforge_project:
115
- rubygems_version: 1.8.24
119
+ rubygems_version: 2.0.3
116
120
  signing_key:
117
- specification_version: 3
121
+ specification_version: 4
118
122
  summary: Minifier plugin for jekyll. This plugin compress html with the help of html_press,
119
123
  compress JavaScript files with the help of uglifier, compress css files with the
120
124
  help of css_press