webpack_assets 0.0.1 → 0.0.2
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/README.md +2 -4
- data/lib/webpack_assets/generators/init.rb +44 -0
- data/lib/webpack_assets/generators/templates/package.json +14 -0
- data/lib/webpack_assets/railtie.rb +1 -1
- data/lib/webpack_assets/version.rb +1 -1
- metadata +4 -3
- data/lib/webpack_assets/generators/webpack.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1213d86568456fea8f6a6d0f34a296c8d0f570d3
|
4
|
+
data.tar.gz: 0ca010337b4d689e0b2d0a067f26f1a42656de7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9cf99cec73b603b52e8525716c765f0f5c84e660ea33829a1d87ef169a2bed2a16a53a20fdc396ca21d7a41c7c9ffabad549938d328648d489df4870a42097
|
7
|
+
data.tar.gz: db51ee44d6e728a28f76b112f7e1db3c7a79bfef83097e9df4c3d8d03a26d710997dd4156a2e0fa11057832f73b9d432f6144c3e99364dad75b274314d7ab64a
|
data/README.md
CHANGED
@@ -45,10 +45,8 @@ To watch for changes from your webpack build files and compile per change, execu
|
|
45
45
|
|
46
46
|
```bash
|
47
47
|
cd <your-rails-root>
|
48
|
-
|
49
|
-
npm install
|
50
|
-
npm install --save jsx-loader
|
51
|
-
bin/rails g webpack_assets:webpack #will build a webpack.config.js
|
48
|
+
bin/rails g webpack_assets:init #will build webpack.config.js, and package.json
|
49
|
+
npm install
|
52
50
|
|
53
51
|
```
|
54
52
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module WebpackAssets
|
4
|
+
class Init < Rails::Generators::Base
|
5
|
+
|
6
|
+
desc "create a default webpack.config.js file if one doesn't exist"
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_webpack_file
|
13
|
+
destination = 'webpack.config.js'
|
14
|
+
if File.exist?(destination)
|
15
|
+
puts "Skipping #{destination} because it already exists"
|
16
|
+
else
|
17
|
+
copy_file 'webpack.config.js', destination
|
18
|
+
puts "** update the entry point in 'webpack.config.js' "
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_package_file
|
23
|
+
destination = 'package.json'
|
24
|
+
if File.exist?(destination)
|
25
|
+
puts "Skipping #{destination} because it already exists"
|
26
|
+
puts "** make sure 'package.json' includes 'webpack' and 'jsx-loader' dependencies"
|
27
|
+
else
|
28
|
+
template 'package.json', destination
|
29
|
+
system "npm install"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_config
|
34
|
+
application "config.webpack_build_path = 'app/assets/javascripts/bundle.js'"
|
35
|
+
application "# path or glob to webpack built assets"
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def app_name
|
40
|
+
Rails.application.class.parent_name.underscore
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpack_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Madsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,8 +51,9 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/webpack_assets.rb
|
54
|
+
- lib/webpack_assets/generators/init.rb
|
55
|
+
- lib/webpack_assets/generators/templates/package.json
|
54
56
|
- lib/webpack_assets/generators/templates/webpack.config.js
|
55
|
-
- lib/webpack_assets/generators/webpack.rb
|
56
57
|
- lib/webpack_assets/railtie.rb
|
57
58
|
- lib/webpack_assets/tasks/webpack.rake
|
58
59
|
- lib/webpack_assets/version.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
module WebpackAssets
|
3
|
-
class Webpack < Rails::Generators::Base
|
4
|
-
|
5
|
-
desc "create a default webpack.config.js file if one doesn't exist"
|
6
|
-
|
7
|
-
def self.source_root
|
8
|
-
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
9
|
-
end
|
10
|
-
|
11
|
-
def create_webpack_file
|
12
|
-
destination = 'webpack.config.js'
|
13
|
-
if File.exist?(destination)
|
14
|
-
puts "Skipping #{destination} because it already exists"
|
15
|
-
else
|
16
|
-
copy_file 'webpack.config.js', destination
|
17
|
-
puts "** update the entry point in 'webpack.config.js' "
|
18
|
-
puts "** update 'package.json' to include 'webpack' and 'jsx-loader' dependencies"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|