rails-webpack 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93e89073862fe0e5f30bfb45c8eadc127d667407
4
- data.tar.gz: 0991ebea1291c13594ad890760a6142ccf28a4b0
3
+ metadata.gz: d764cae98ddef26b2d9a07d8fcc64f7331478d53
4
+ data.tar.gz: 9e654db45596e44acb7d3e266bb8cd81f28c4a19
5
5
  SHA512:
6
- metadata.gz: 07fce28e3e59334302f1e09c9880df91f09837a0d22552f932c42bc5bdebf91c251080f3f36c630ad5237ccdccbd6ed3d0f21dae2c29694b308d0d1108c606e1
7
- data.tar.gz: ffb5813d155d9c476c13ce7b721c86427909bab6b7b4b9f11dcf8e97e460fb6778b49c36d912b8e1e3aaf14424be0d10bd4809f5fb39d0efb66c86101d86c14a
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: 'webpack'
39
- version: '~1.8'
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,5 +1,5 @@
1
1
  module Rails
2
2
  module Webpack
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -0,0 +1,4 @@
1
+ #
2
+ # Common Manifest File
3
+ # add dependencies for webpack compilation
4
+ # run webpack pipeline against files in src/pages automatically
@@ -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
- #run webpack
6
- webpack(
7
- resolve:
8
- root: [root, path.join(root, "bower_components"), path.join(root, 'src')]
9
- entry:
10
- common: 'pages/common.coffee'
11
- devise: 'pages/devise.coffee'
12
- output:
13
- path: path.join root, '../assets/compiled/'
14
- filename: '[name].bundle.js'
15
- module:
16
- loaders: [
17
- #{ test: /\.css$/, loader: 'style!css' },
18
- { test: /\.coffee$/, loader: 'coffee' },
19
- { test: /\.(coffee\.md|litcoffee)$/, loader: 'coffee?literate' },
20
- { test: /\.less$/, loader: 'style!css!less' }
21
- ]
22
- plugins: [
23
- new webpack.ResolverPlugin(
24
- new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
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
@@ -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.1.1
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