rails-webpack 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/webpack/config_generator.rb +4 -0
- data/lib/generators/webpack/templates/webpack.yml.erb +4 -4
- data/lib/rails/webpack/version.rb +1 -1
- data/lib/tasks/files/src/page.common.coffee +4 -0
- data/lib/tasks/files/tasks/webpack.coffee +26 -25
- data/lib/tasks/webpack.rake +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d764cae98ddef26b2d9a07d8fcc64f7331478d53
|
4
|
+
data.tar.gz: 9e654db45596e44acb7d3e266bb8cd81f28c4a19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b916ec4993cdc720d0170efa10a45ddac6d362a837c44da7a307575f7433a9e873fb4549d5b0eeba71adc4b1064c0a5704b482b72cfbb7c65c71213934c7a02
|
7
|
+
data.tar.gz: 05d7e45538d286b103db0f56848e5e3b8a4ce7839c468bd130762433c537b9d2c10381e523c70ae6c542043431eb8113503a0f41afe3c08acb146f9b5289b028
|
@@ -2,6 +2,10 @@ module Webpack
|
|
2
2
|
class ConfigGenerator < Rails::Generators::Base
|
3
3
|
source_root File.expand_path(__dir__)
|
4
4
|
|
5
|
+
def change_rails_context
|
6
|
+
gsub_file 'Rakefile', 'require File.expand_path(\'../config/application\', __FILE__)', 'require_realtive \'config/environment\''
|
7
|
+
end
|
8
|
+
|
5
9
|
def init_config
|
6
10
|
copy_file 'files/webpack.rb', 'config/initializers/webpack.rb'
|
7
11
|
if File.exist? Rails.root.join('config', 'webpack.yml')
|
@@ -24,8 +24,6 @@ npm:
|
|
24
24
|
# - webpack
|
25
25
|
# - rails
|
26
26
|
dependencies: []
|
27
|
-
# - name: 'socket.io'
|
28
|
-
# version: '~1.3'
|
29
27
|
develop_dependencies:
|
30
28
|
- name: 'coffee-loader'
|
31
29
|
version: '~0.7'
|
@@ -35,8 +33,10 @@ npm:
|
|
35
33
|
version: '~0.12'
|
36
34
|
- name: 'css-loader'
|
37
35
|
version: '~0.17'
|
38
|
-
- name: '
|
39
|
-
version: '~1.
|
36
|
+
- name: 'vinyl-named'
|
37
|
+
version: '~1.1'
|
38
|
+
- name: 'webpack-stream'
|
39
|
+
version: '~2.1'
|
40
40
|
- name: 'bower'
|
41
41
|
version: '~1.4'
|
42
42
|
- name: 'gulp'
|
@@ -1,33 +1,34 @@
|
|
1
1
|
webpack = (gulp, plugins, root) ->
|
2
2
|
path = require 'path'
|
3
3
|
webpack = require 'webpack'
|
4
|
+
stream = require 'webpack-stream'
|
5
|
+
named = require 'vinyl-named'
|
4
6
|
(callback) ->
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
(err, stats) ->
|
28
|
-
throw new gutil.PluginError('webpack', err) if(err)
|
29
|
-
plugins.util.log('[webpack]', stats.toString())
|
7
|
+
gulp.src('src/pages/**.coffee')
|
8
|
+
.pipe(named())
|
9
|
+
.pipe(stream(
|
10
|
+
resolve:
|
11
|
+
root: [root, path.join(root, "bower_components"), path.join(root, 'src')]
|
12
|
+
output:
|
13
|
+
filename: '[name].bundle.js'
|
14
|
+
module:
|
15
|
+
loaders: [
|
16
|
+
#{ test: /\.css$/, loader: 'style!css' },
|
17
|
+
{ test: /\.coffee$/, loader: 'coffee' },
|
18
|
+
{ test: /\.(coffee\.md|litcoffee)$/, loader: 'coffee?literate' },
|
19
|
+
{ test: /\.less$/, loader: 'style!css!less' }
|
20
|
+
]
|
21
|
+
plugins: [
|
22
|
+
new webpack.ResolverPlugin(
|
23
|
+
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
|
24
|
+
)
|
25
|
+
],
|
26
|
+
(err, stats) ->
|
27
|
+
throw new gutil.PluginError('webpack', err) if(err)
|
28
|
+
plugins.util.log('[webpack]', stats.toString())
|
30
29
|
callback())
|
30
|
+
)
|
31
|
+
.pipe(gulp.dest(path.join root, '../assets/compiled/'))
|
31
32
|
return null
|
32
33
|
|
33
34
|
module.exports = webpack
|
data/lib/tasks/webpack.rake
CHANGED
@@ -12,7 +12,8 @@ namespace :webpack do
|
|
12
12
|
|
13
13
|
desc 'Initialize Webpack environments'
|
14
14
|
task :init do
|
15
|
-
thor :empty_directory, 'app/webpack'
|
15
|
+
thor :empty_directory, 'app/webpack/src/pages'
|
16
|
+
thor :copy_file, 'files/src/page.common.coffee', 'app/webpack/src/pages/common.coffee'
|
16
17
|
|
17
18
|
thor :gsub_file, 'config/initializers/assets.rb', /(version\s=\s)["'][0-9]+(\.[0-9]+)*["']$/, "\\1'#{Rails.application.config.webpack.version}'"
|
18
19
|
thor :copy_file, 'files/tasks.coffee', 'app/webpack/tasks.coffee'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-webpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeong, Jiung
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/rails/webpack.rb
|
74
74
|
- lib/rails/webpack/railtie.rb
|
75
75
|
- lib/rails/webpack/version.rb
|
76
|
+
- lib/tasks/files/src/page.common.coffee
|
76
77
|
- lib/tasks/files/tasks.coffee
|
77
78
|
- lib/tasks/files/tasks/bower.coffee
|
78
79
|
- lib/tasks/files/tasks/watch.coffee
|