jekyll-stitch-plus 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +5 -0
- data/README.md +13 -9
- data/jekyll-stitch-plus.gemspec +1 -3
- data/lib/jekyll-stitch-plus.rb +36 -25
- data/lib/jekyll-stitch-plus/version.rb +1 -1
- data/test/_config.yml +6 -4
- data/test/{_plugins → plugins}/jekyll-stitch-plus.rb +0 -0
- data/test/{_layouts → source/_layouts}/default.html +0 -0
- data/test/{_layouts → source/_layouts}/post.html +0 -0
- data/test/{index.html → source/index.html} +0 -0
- data/test/{js → source/js}/lib/foo.coffee +0 -0
- data/test/{js → source/js}/lib/test.js +0 -0
- data/test/{js → source/js}/modules/test-module.js +0 -0
- metadata +10 -38
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTlmODRlYWZlMTk2YTY1MWI5Y2ExNDk1ZjI0NTM0ZWUwMjI4MDQwMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjliNDAyZTE4YzhlMWNmYzRmM2VmNDE1M2Y1NTk1NmMyNWUwYWNiNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWU1Y2RhNzM5YjFmODU0MGNhY2JlMDcxNDU3NjMwNTJiNGQyNGE0YTRkNTg2
|
10
|
+
YzYyMjYzOTE1NDMzOGRmZjQzNGY4YTE4MzMxOGRkM2EzM2QyYWVjODliNTU3
|
11
|
+
NTUxMzRjMmNjOTVkNTUzZjg2Nzk2Y2MxZDMxNGE5YmI1NDdhYzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjdkNWE4ZGNiNzEwMzk1MmNiNTgzZTA1ZWFmOTU1NDBmMjM1NTZkY2FkNWQ5
|
14
|
+
MDRmNzczNjRmNjRiZGMyZDMwM2E3NzVmMDljZWRmYTZkODdjNTkwYzcyYmRi
|
15
|
+
ZTVlMTUwMGZiZWVjOGJiZTMzZjY0YmE3Y2UxNzI0YTM3ZTZiNzI=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -24,15 +24,15 @@ Next add `{% stitch_js_tag %}` to a template to render `<script src='/javascript
|
|
24
24
|
|
25
25
|
## Configuration
|
26
26
|
|
27
|
-
| Config | Description
|
28
|
-
|
29
|
-
| `dependencies` | Array of files/directories to be added first as global javascripts
|
30
|
-
| `paths` | Array of directories where javascripts will be wrapped as CommonJS modules | nil |
|
31
|
-
| `output` | A path to write the compiled javascript
|
32
|
-
| `fingerprint` | Add a fingerprint to the file name for super cache busting power
|
33
|
-
| `cleanup` | Automatically remove previously compiled files
|
34
|
-
| `uglify` | Smash javascript using the Uglifier gem
|
35
|
-
| `uglify_options` | Options for the Uglifier gem. See [the docs](https://github.com/lautis/uglifier#usage) for details.
|
27
|
+
| Config | Description | Default |
|
28
|
+
|:-----------------|:-----------------------------------------------------------------------------------------------------|:------------|
|
29
|
+
| `dependencies` | Array of files/directories to be added first as global javascripts (relative to Jekyll's pwd) | nil |
|
30
|
+
| `paths` | Array of directories where javascripts will be wrapped as CommonJS modules (reltive to Jekyll's pwd) | nil |
|
31
|
+
| `output` | A path to write the compiled javascript, (relative to Jekyll's source directory) | 'all.js' |
|
32
|
+
| `fingerprint` | Add a fingerprint to the file name for super cache busting power | false |
|
33
|
+
| `cleanup` | Automatically remove previously compiled files | true |
|
34
|
+
| `uglify` | Smash javascript using the Uglifier gem | false |
|
35
|
+
| `uglify_options` | Options for the Uglifier gem. See [the docs](https://github.com/lautis/uglifier#usage) for details. | {} |
|
36
36
|
|
37
37
|
To configure this plugin add Jekyll's YAML configuration file. Here's an example.
|
38
38
|
|
@@ -50,6 +50,10 @@ stitch:
|
|
50
50
|
fingerprint: true
|
51
51
|
```
|
52
52
|
|
53
|
+
Note: javascripts don't have to be kept in the source directory to be compiled by stitch-plus. The configuration paths for `dependencies` and `paths` should point to your javascripts relative to Jekyll's current working directory and they can be anywhere on your file system. Keep in mind though that the ouput path is relative to Jekyll's source directory since the file must be written to the source directory to be managed by Jekyll.
|
54
|
+
|
55
|
+
### To Uglify Output
|
56
|
+
|
53
57
|
To uglify javascript output you must first install [the uglifier gem](https://github.com/lautis/uglifier) then set your Jekyll environment to production. There are two ways to do this;
|
54
58
|
either set `env: production` in your Jekyll config, or set your shell JEKYLL_ENV to 'production' (case does not matter).
|
55
59
|
|
data/jekyll-stitch-plus.gemspec
CHANGED
@@ -16,9 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_runtime_dependency "
|
20
|
-
spec.add_runtime_dependency "jekyll-page-hooks", "~> 1.0.2"
|
21
|
-
spec.add_runtime_dependency "stitch-plus", "~> 1.0.8"
|
19
|
+
spec.add_runtime_dependency "stitch-plus", "~> 1.0.9"
|
22
20
|
|
23
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
22
|
spec.add_development_dependency "rake"
|
data/lib/jekyll-stitch-plus.rb
CHANGED
@@ -5,45 +5,56 @@ module Jekyll
|
|
5
5
|
class StitchPlus < Generator
|
6
6
|
def generate(site)
|
7
7
|
config = site.config
|
8
|
-
|
9
|
-
begin
|
10
|
-
require 'uglifier'
|
11
|
-
@uglifier = Uglifier.new config['stitch']['uglify_options'] || {}
|
12
|
-
if (ENV['JEKYLL_ENV'] || config['env']).downcase == 'production'
|
13
|
-
config['stitch']['uglify'] ||= true
|
14
|
-
end
|
15
|
-
rescue LoadError
|
16
|
-
end
|
8
|
+
filename = ''
|
17
9
|
|
18
10
|
stitch = ::StitchPlus.new(config['stitch'])
|
19
11
|
options = stitch.options
|
12
|
+
dir = File.dirname(options[:output])
|
20
13
|
|
21
|
-
#
|
22
|
-
|
23
|
-
|
14
|
+
# If Guard Stitch Plus is running, let it handle the writes
|
15
|
+
if ENV['GUARD_STITCH_PLUS']
|
16
|
+
# Guard may have a different hash and therefore a different output file
|
17
|
+
# Reading the written filename from an ENV allows us to avoid unnecessary writes
|
18
|
+
#
|
19
|
+
filename = File.basename ENV['GUARD_STITCH_PLUS_OUTPUT']
|
20
|
+
else
|
24
21
|
|
25
|
-
|
26
|
-
|
22
|
+
begin
|
23
|
+
require 'uglifier'
|
24
|
+
@uglifier = Uglifier.new config['stitch']['uglify_options'] || {}
|
25
|
+
if (ENV['JEKYLL_ENV'] || config['env']).downcase == 'production'
|
26
|
+
config['stitch']['uglify'] ||= true
|
27
|
+
end
|
28
|
+
rescue LoadError
|
29
|
+
end
|
27
30
|
|
28
|
-
|
29
|
-
|
31
|
+
path = File.join site.source, options[:output]
|
32
|
+
stitch.set_options({output: path, uglify: config['stitch']['uglify']})
|
30
33
|
|
31
|
-
|
32
|
-
|
34
|
+
puts '' # Because Jekyll doesn't give a newline for other output
|
35
|
+
stitch.write
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
filename = File.basename stitch.last_write
|
38
|
+
|
39
|
+
# Ensure the compiled file is written to the destination directory
|
40
|
+
site.static_files << StaticFile.new(site, site.source, dir, filename)
|
41
|
+
|
42
|
+
end
|
37
43
|
|
38
44
|
# Don't copy static source files or deleted files to the destination directory
|
39
|
-
|
40
|
-
remove.concat stitch.deleted
|
41
|
-
cleanup site, remove
|
45
|
+
cleanup site, stitch
|
42
46
|
|
47
|
+
# Store the javascript tag for the liquid tag to retrieve
|
48
|
+
url = File.join (config['root'] || '/'), dir, filename
|
49
|
+
site.config['stitch']['js_tag'] = "<script src='#{url}'></script>"
|
43
50
|
end
|
44
51
|
|
45
52
|
# Remove files from Jekyll's static_files array
|
46
|
-
def cleanup(site,
|
53
|
+
def cleanup(site, stitch)
|
54
|
+
|
55
|
+
files = stitch.all_files.map{ |f| File.absolute_path(f)}
|
56
|
+
files.concat stitch.deleted
|
57
|
+
|
47
58
|
if files.size > 0
|
48
59
|
site.static_files.clone.each do |sf|
|
49
60
|
if sf.kind_of?(Jekyll::StaticFile) and files.include? sf.path
|
data/test/_config.yml
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
name: Your New Jekyll Site
|
2
2
|
markdown: redcarpet
|
3
3
|
pygments: true
|
4
|
+
source: source
|
5
|
+
plugins: plugins
|
4
6
|
|
5
7
|
env: 'production'
|
6
8
|
|
7
9
|
stitch:
|
8
10
|
dependencies:
|
9
|
-
- 'js/lib/jquery.js'
|
10
|
-
- 'js/lib/underscore.js'
|
11
|
-
- 'js/lib' # globs the js/lib dir
|
12
|
-
paths: 'js/modules' # globs the js/modules dir
|
11
|
+
- 'source/js/lib/jquery.js'
|
12
|
+
- 'source/js/lib/underscore.js'
|
13
|
+
- 'source/js/lib' # globs the js/lib dir
|
14
|
+
paths: 'source/js/modules' # globs the js/modules dir
|
13
15
|
output: 'js/site.js'
|
14
16
|
fingerprint: true
|
15
17
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-stitch-plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
@@ -10,48 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: jekyll
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: jekyll-page-hooks
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.2
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.2
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: stitch-plus
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - ~>
|
46
18
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0.
|
19
|
+
version: 1.0.9
|
48
20
|
type: :runtime
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
24
|
- - ~>
|
53
25
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0.
|
26
|
+
version: 1.0.9
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: bundler
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,13 +71,13 @@ files:
|
|
99
71
|
- test/.gitignore
|
100
72
|
- test/Gemfile
|
101
73
|
- test/_config.yml
|
102
|
-
- test/
|
103
|
-
- test/_layouts/
|
104
|
-
- test/
|
105
|
-
- test/index.html
|
106
|
-
- test/js/lib/foo.coffee
|
107
|
-
- test/js/lib/test.js
|
108
|
-
- test/js/modules/test-module.js
|
74
|
+
- test/plugins/jekyll-stitch-plus.rb
|
75
|
+
- test/source/_layouts/default.html
|
76
|
+
- test/source/_layouts/post.html
|
77
|
+
- test/source/index.html
|
78
|
+
- test/source/js/lib/foo.coffee
|
79
|
+
- test/source/js/lib/test.js
|
80
|
+
- test/source/js/modules/test-module.js
|
109
81
|
homepage: https://github.com/octopress/jekyll-stitch-plus
|
110
82
|
licenses:
|
111
83
|
- MIT
|