jekyll-browserify 0.2.0 → 1.0.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
  SHA1:
3
- metadata.gz: 2d00d5fd0dadbc112e748de843c10645bda4f053
4
- data.tar.gz: 210e2febf42e45bb0ef29f97ba9dde1bf5f63d84
3
+ metadata.gz: 90badef3c624cf26da7b1b9581538657ebf60564
4
+ data.tar.gz: bb525bdd295d1f500b17ef7a97e47c63f5c2410d
5
5
  SHA512:
6
- metadata.gz: 518c885e8f1a041cfdefcf54ef5d5c6e980592ad5a465fda0d479a04613d27d128e6bc5dd337ac93bfee0b0b83aefe34ed1b94ff51313a0c04ab933118f37957
7
- data.tar.gz: e9a98cdb40aa554a36066becec04f780a4e763ad8e0fbf311f496e2ca00466f65772bf7f0d0e065cedf89b1e928beda25f04d30d5ddaf1e6a8744808bf113415
6
+ metadata.gz: f0219b23ed2d72631d5aa84b0512c2b528c25eaae9276dfa3785d6b9f530172b770a23621b1bdb0b02843aa13fc371165f5f66defe51d54c5a6685eeedcee084
7
+ data.tar.gz: dc925995978b5b3f9a0bd2bc0cdcf5e48a522cc812db56df953ce77d907a5afc7d92be538f4243c1f12081fea20f7574db9848a95286995ec319645c53a86771
data/README.md CHANGED
@@ -31,17 +31,16 @@ $ cat main.js
31
31
  console.log("foo");
32
32
  $ jekyll build
33
33
  $ cat _site/main.js
34
- # conterted code
34
+ # ... conterted code ...
35
35
  ~~~~~~~~~~~~~~~~~~~~~~~~~
36
36
 
37
37
  Add the below to `_config.yaml` if you want to use with [babel][]:
38
38
 
39
39
  ~~~~~~~~~~~~~~~~~~~~~~~~~~_config.yaml
40
+ # require `npm install -D browserify baberify babel-preset-es2015`
41
+
40
42
  browserify:
41
- modules:
42
- - babelify
43
- - babel-preset-es2015
44
- option: "-t [ babelify --presets es2015 ]"
43
+ command: "$(npm bin)/browserify -t [ babelify --presets es2015 ]"
45
44
  ~~~~~~~~~~~~~~~~~~~~~~~~~~
46
45
 
47
46
  ### Confing items and Default Values
@@ -49,9 +48,22 @@ browserify:
49
48
  ~~~~~~~~~~~~~~~~~~~~~~~~~yaml
50
49
  # _config.yaml
51
50
  browserify:
52
- modules: [] # required modules
53
- option: "" # browserify option string
54
51
  exts: [".js"] # target exts to convert
52
+
53
+ # set nvm properties if you want to use with nvm installed automatically
54
+ nvm:
55
+
56
+ # required modules
57
+ modules: []
58
+
59
+ # browserify option string
60
+ option: ""
61
+
62
+ # node version if you specify, or use '.nvmrc' if 'null'
63
+ node_version: null
64
+
65
+ # use installed 'browserify'
66
+ command: "browserify -"
55
67
  ~~~~~~~~~~~~~~~~~~~~~~~~~
56
68
 
57
69
  [babel]: https://github.com/babel/babelify
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency "browserify_rb", "~> 0.3.0"
29
+ spec.add_runtime_dependency "browserify_rb", "~> 1.0.0"
30
30
 
31
31
  spec.add_development_dependency "jekyll", ENV['JEKYLL_VERSION'] ? "~> #{ENV['JEKYLL_VERSION']}" : ">= 2.0"
32
32
  spec.add_development_dependency "bundler", "~> 1.10"
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Browserify
3
- VERSION = "0.2.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ module Jekyll
7
7
  def initialize config
8
8
  super
9
9
  @browserify = nil
10
+ system "npm install"
10
11
  end
11
12
 
12
13
  def matches ext
@@ -24,28 +25,42 @@ module Jekyll
24
25
 
25
26
  def setup
26
27
  require "browserify_rb"
27
- @browserify = BrowserifyRb.new(
28
- required_modules: modules,
29
- browserify_opts: option,
30
- nvm_dir: File.join(ENV["PWD"], ".nvm"),
31
- node_ver: node_ver
32
- )
28
+ if use_nvm?
29
+ @browserify = BrowserifyRb::Nvm::Browserify.new(
30
+ required_modules: nvm_modules,
31
+ browserify_opts: nvm_option,
32
+ nvm_dir: File.join(ENV["PWD"], ".nvm"),
33
+ node_ver: nvm_node_ver
34
+ )
35
+ else
36
+ @browserify = BrowserifyRb::Browserify.new(
37
+ command: command
38
+ )
39
+ end
33
40
  end
34
41
 
35
42
  def exts
36
43
  (config("browserify", "exts") || [".js"]).map(&:downcase)
37
44
  end
38
45
 
39
- def modules
40
- config("browserify", "modules") || []
46
+ def command
47
+ config("browserify", "command") || "browserify -"
41
48
  end
42
49
 
43
- def option
44
- config("browserify", "option") || ""
50
+ def nvm_modules
51
+ config("browserify", "nvm", "modules") || []
45
52
  end
46
53
 
47
- def node_ver
48
- config("browserify", "node_version")
54
+ def nvm_option
55
+ config("browserify", "nvm", "option") || ""
56
+ end
57
+
58
+ def nvm_node_ver
59
+ config("browserify", "nvm", "node_version")
60
+ end
61
+
62
+ def use_nvm?
63
+ not config("browserify", "nvm").nil?
49
64
  end
50
65
 
51
66
  def config *path
data/package.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "jekyll-browserify",
3
+ "private": true,
4
+ "devDependencies": {
5
+ "babel-preset-es2015": "^6.3.13",
6
+ "babelify": "^7.2.0",
7
+ "browserify": "^12.0.1"
8
+ }
9
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-browserify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keiichiro Ui
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.0
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.0
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -99,6 +99,7 @@ files:
99
99
  - lib/jekyll/browserify.rb
100
100
  - lib/jekyll/browserify/version.rb
101
101
  - lib/jekyll/converters/browserify.rb
102
+ - package.json
102
103
  homepage: https://github.com/kui/jekyll-browserify
103
104
  licenses:
104
105
  - MIT