webpackrails 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/lib/{webpack-rails → webpackrails}/railtie.rb +1 -1
- data/lib/{webpack-rails → webpackrails}/version.rb +1 -1
- data/lib/{webpack-rails → webpackrails}/webpack_error.rb +0 -0
- data/lib/{webpack-rails → webpackrails}/webpack_logger.rb +0 -0
- data/lib/{webpack-rails → webpackrails}/webpack_processor.rb +5 -5
- data/lib/webpackrails.rb +12 -0
- data/{webpack-rails.gemspec → webpackrails.gemspec} +2 -2
- metadata +10 -10
- data/lib/webpack-rails.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fa2985efb84baf179b44c31c54b45b7bebb8a79
|
4
|
+
data.tar.gz: 90aeb67545627aeb8227b627c5507bbe056686e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0172bd0f2f2e60ed678b4ec5991e5e10e8368b23d2c3412b70e66f140c35cb7942be659916ebfb8207d18af5821c5d243af52a6261b7236d46633aa887188dd
|
7
|
+
data.tar.gz: 18ecc798dd746604ec293e89a6c7274e543a24451c7039045135d2a9fed4356397d1b6d5b8a2c019729c4c39f4305c76d726865cf4558fc6105942091108aed2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -40,7 +40,7 @@ webpack config file within `application.rb`
|
|
40
40
|
|
41
41
|
### Config
|
42
42
|
|
43
|
-
See [source](https://raw.githubusercontent.com/towry/
|
43
|
+
See [source](https://raw.githubusercontent.com/towry/webpackrails/master/lib/webpackrails/railtie.rb)
|
44
44
|
|
45
45
|
## Development
|
46
46
|
|
@@ -50,7 +50,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
50
50
|
|
51
51
|
## Contributing
|
52
52
|
|
53
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/towry/
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/towry/webpackrails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
54
54
|
|
55
55
|
|
56
56
|
## License
|
@@ -17,7 +17,7 @@ module WebpackRails
|
|
17
17
|
config.webpack_rails.node_bin = "node_modules/.bin/"
|
18
18
|
|
19
19
|
initializer :setup_webpack do |app|
|
20
|
-
app.assets.register_postprocessor "application/javascript",
|
20
|
+
app.assets.register_postprocessor "application/javascript", WebpackRails::WebpackProcessor
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@ require 'fileutils'
|
|
7
7
|
require 'shellwords'
|
8
8
|
|
9
9
|
module WebpackRails
|
10
|
-
class
|
10
|
+
class WebpackProcessor < Tilt::Template
|
11
11
|
attr_accessor :config
|
12
12
|
|
13
13
|
def initialize(template)
|
@@ -25,7 +25,7 @@ module WebpackRails
|
|
25
25
|
# return if there is nothing to do
|
26
26
|
return data unless should_webpack?
|
27
27
|
|
28
|
-
run_webpack(context.logical_path)
|
28
|
+
run_webpack(context.pathname || context.logical_path)
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
@@ -82,7 +82,7 @@ module WebpackRails
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def commonjs_module?
|
85
|
-
data.to_s.include?("module.exports") || data.present? && data.to_s.include?("require")
|
85
|
+
data.to_s.include?("module.exports") || data.present? && data.to_s.include?("require") || data.present? && data.to_s.include?("import")
|
86
86
|
end
|
87
87
|
|
88
88
|
def asset_paths
|
@@ -101,7 +101,7 @@ module WebpackRails
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def run_webpack(logical_path=nil)
|
104
|
-
command_options = "--config #{@config_file} #{logical_path} --output-filename"
|
104
|
+
command_options = "--colors --config #{@config_file} #{logical_path} --bail --output-filename"
|
105
105
|
output_file = Tempfile.new("output", rails_path(tmp_path))
|
106
106
|
command_options << " #{output_file.path.inspect}"
|
107
107
|
|
@@ -109,7 +109,7 @@ module WebpackRails
|
|
109
109
|
|
110
110
|
base_directory = File.dirname(file)
|
111
111
|
|
112
|
-
Logger::log "
|
112
|
+
Logger::log "\nWebpack: #{command}"
|
113
113
|
stdout, stderr, status = Open3.capture3(env, command, stdin_data: data, chdir: base_directory)
|
114
114
|
|
115
115
|
if !status.success?
|
data/lib/webpackrails.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'sprockets'
|
4
|
+
|
5
|
+
require 'webpackrails/webpack_processor'
|
6
|
+
require 'webpackrails/webpack_logger'
|
7
|
+
require 'webpackrails/webpack_error'
|
8
|
+
require 'webpackrails/railtie'
|
9
|
+
require 'webpackrails/version'
|
10
|
+
|
11
|
+
module WebpackRails
|
12
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'webpackrails/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "webpackrails"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Make Webpack work with Rails for you}
|
13
13
|
spec.description = %q{Webpack + Rails ≠ CommonJS Heaven}
|
14
|
-
spec.homepage = "https://github.com/towry/
|
14
|
+
spec.homepage = "https://github.com/towry/webpackrails"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpackrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- towry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -129,14 +129,14 @@ files:
|
|
129
129
|
- Rakefile
|
130
130
|
- bin/console
|
131
131
|
- bin/setup
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
-
|
139
|
-
homepage: https://github.com/towry/
|
132
|
+
- lib/webpackrails.rb
|
133
|
+
- lib/webpackrails/railtie.rb
|
134
|
+
- lib/webpackrails/version.rb
|
135
|
+
- lib/webpackrails/webpack_error.rb
|
136
|
+
- lib/webpackrails/webpack_logger.rb
|
137
|
+
- lib/webpackrails/webpack_processor.rb
|
138
|
+
- webpackrails.gemspec
|
139
|
+
homepage: https://github.com/towry/webpackrails
|
140
140
|
licenses:
|
141
141
|
- MIT
|
142
142
|
metadata:
|
data/lib/webpack-rails.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'sprockets'
|
4
|
-
|
5
|
-
require 'webpack-rails/webpack_processor'
|
6
|
-
require 'webpack-rails/webpack_logger'
|
7
|
-
require 'webpack-rails/webpack_error'
|
8
|
-
require 'webpack-rails/railtie'
|
9
|
-
require 'webpack-rails/version'
|
10
|
-
|
11
|
-
module WebpackRails
|
12
|
-
end
|