browserify-rails 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/browserify-rails/browserify_processor.rb +13 -10
- data/lib/browserify-rails/railtie.rb +2 -0
- data/lib/browserify-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a2c2fac84b40025981f93d92c55fcc97f51866c
|
4
|
+
data.tar.gz: 9b8c378b03ef9ee69aa4844c8e3488964e7209a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b827dd045e8dc3b62a0067ba6883390015604f724a6ba4484c2aa4fc9809cd47aa77928d4b74c3c70e4841ad3f56944f16311febcf4d9ba520c62b40c3473d0
|
7
|
+
data.tar.gz: a71d24d661d23de54cbdd8762ce364925095116fee74affbdcfc08f6248c8d5e3fd5768aa617d8aaf2f45bf2b2144c260e65412f82819c1555278afa2b3e7082
|
data/README.md
CHANGED
@@ -158,6 +158,12 @@ To make browserify-rails work inside an isolated engine, add the engine app dire
|
|
158
158
|
config.browserify_rails.paths << lambda { |p| p.start_with?(Engine.root.join("app").to_s) }
|
159
159
|
```
|
160
160
|
|
161
|
+
If you wish to put the node_modules directory within the engine, you have some control over it with:
|
162
|
+
|
163
|
+
```ruby
|
164
|
+
config.browserify_rails.node_bin = "some/directory"
|
165
|
+
```
|
166
|
+
|
161
167
|
## Support for rails asset directories as non-relative module sources
|
162
168
|
|
163
169
|
In the Rails asset pipeline, it is common to have files in
|
@@ -4,11 +4,6 @@ require "tempfile"
|
|
4
4
|
|
5
5
|
module BrowserifyRails
|
6
6
|
class BrowserifyProcessor < Tilt::Template
|
7
|
-
NODE_BIN = "node_modules/.bin/"
|
8
|
-
|
9
|
-
BROWSERIFY_CMD = File.join(NODE_BIN, "browserify").freeze
|
10
|
-
BROWSERIFYINC_CMD = File.join(NODE_BIN, "browserifyinc").freeze
|
11
|
-
|
12
7
|
TMP_PATH = File.join("tmp/browserify-rails").freeze
|
13
8
|
|
14
9
|
def prepare
|
@@ -34,6 +29,14 @@ module BrowserifyRails
|
|
34
29
|
Rails.application.config.browserify_rails
|
35
30
|
end
|
36
31
|
|
32
|
+
def browserfy_cmd
|
33
|
+
@browserfy_cmd ||= File.join(config.node_bin, "browserify").freeze
|
34
|
+
end
|
35
|
+
|
36
|
+
def browserfyinc_cmd
|
37
|
+
@browserfyinc_cmd ||= File.join(config.node_bin, "browserifyinc").freeze
|
38
|
+
end
|
39
|
+
|
37
40
|
def ensure_tmp_dir_exists!
|
38
41
|
FileUtils.mkdir_p(rails_path(TMP_PATH))
|
39
42
|
end
|
@@ -42,13 +45,13 @@ module BrowserifyRails
|
|
42
45
|
error = ->(cmd) { "Unable to run #{cmd}. Ensure you have installed it with npm." }
|
43
46
|
|
44
47
|
# Browserify has to be installed in any case
|
45
|
-
if !File.exists?(rails_path(
|
46
|
-
raise BrowserifyRails::BrowserifyError.new(error.call(
|
48
|
+
if !File.exists?(rails_path(browserfy_cmd))
|
49
|
+
raise BrowserifyRails::BrowserifyError.new(error.call(browserfy_cmd))
|
47
50
|
end
|
48
51
|
|
49
52
|
# If the user wants to use browserifyinc, we need to ensure it's there too
|
50
|
-
if config.use_browserifyinc && !File.exists?(rails_path(
|
51
|
-
raise BrowserifyRails::BrowserifyError.new(error.call(
|
53
|
+
if config.use_browserifyinc && !File.exists?(rails_path(browserfyinc_cmd))
|
54
|
+
raise BrowserifyRails::BrowserifyError.new(error.call(browserfyinc_cmd))
|
52
55
|
end
|
53
56
|
end
|
54
57
|
|
@@ -170,7 +173,7 @@ module BrowserifyRails
|
|
170
173
|
end
|
171
174
|
|
172
175
|
def browserify_command(force=nil)
|
173
|
-
rails_path(uses_browserifyinc(force) ?
|
176
|
+
rails_path(uses_browserifyinc(force) ? browserfyinc_cmd : browserfy_cmd)
|
174
177
|
end
|
175
178
|
|
176
179
|
def options
|
@@ -9,6 +9,8 @@ module BrowserifyRails
|
|
9
9
|
config.browserify_rails.paths = [lambda { |p| p.start_with?(Rails.root.join("app").to_s) },
|
10
10
|
lambda { |p| p.start_with?(Rails.root.join("node_modules").to_s) }]
|
11
11
|
|
12
|
+
config.browserify_rails.node_bin = "node_modules/.bin/"
|
13
|
+
|
12
14
|
# Should node_modules be evaluated assets before run_browserify
|
13
15
|
config.browserify_rails.evaluate_node_modules = false
|
14
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserify-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Hsu, Cymen Vig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|