vuejs-webpack-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3dec3036b208c0e9c42d5553abc67c5ec278bcc2
4
+ data.tar.gz: 45a19234d628fdf01ce58af0c2e4447f06550a6a
5
+ SHA512:
6
+ metadata.gz: e148a37f5b793a314cd62426aa48a206a8d2b607a7c5c5845e8a8b65c22913b3f4624fde30c4e317053e226332eea2e3598b9d4a6cc14aced7badf21c1fa80ca
7
+ data.tar.gz: 8b65b5cd57a115eebc625f27411055bc0b56b5a6df4d7dc9486c79e4947f29567c56b6d431d58664956179733c5ef2f7de7b3a92a26693aa5d9c68294c76dbc9
@@ -0,0 +1,73 @@
1
+ module VuejsWebpackRails
2
+ # :nodoc:
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+
6
+ desc "Install everything you need for a basic vuejs-webpack-rails integration"
7
+
8
+ def run_webpack_rails
9
+ generate "webpack_rails:install"
10
+ end
11
+
12
+ def copy_vue_config
13
+ copy_file 'vue.config.js', 'config/vue.config.js'
14
+ end
15
+
16
+ def modify_webpack_config
17
+ inject_into_file 'config/webpack.config.js', after: /\s*var StatsPlugin.*/ do
18
+ <<-EOF.strip_heredoc
19
+
20
+ var merge = require('webpack-merge')
21
+ var vueConfig = require('./vue.config')
22
+ EOF
23
+ end
24
+
25
+ gsub_file 'config/webpack.config.js', /module.exports = config/ do
26
+ 'module.exports = merge(config, vueConfig)'
27
+ end
28
+ end
29
+
30
+ def modify_package_json
31
+ insert_into_file "package.json", before: /\s}\s$/ do
32
+ <<-EOF.strip_heredoc
33
+ ,
34
+ "private": true,
35
+ "engines": {
36
+ "node": ">= 4.0.0",
37
+ "npm": ">= 3.0.0"
38
+ },
39
+ "babel": {
40
+ "presets": [
41
+ "es2015"
42
+ ],
43
+ "plugins": [
44
+ [
45
+ "transform-runtime",
46
+ {
47
+ "polyfill": false,
48
+ "regenerator": true
49
+ }
50
+ ]
51
+ ]
52
+ }
53
+ EOF
54
+ end
55
+ end
56
+
57
+ def install_packages
58
+ install_npm_packanges '-S', *%w(vue lodash)
59
+ install_npm_packanges '-D', *%w(webpack-manifest-plugin extract-text-webpack-plugin webpack-merge)
60
+ install_npm_packanges '-D', *%w(babel-core babel-loader babel-runtime babel-plugin-transform-runtime babel-preset-es2015)
61
+ install_npm_packanges '-D', *%w(coffee-loader coffee-script)
62
+ install_npm_packanges '-D', *%w(css-loader style-loader node-sass sass-loader)
63
+ install_npm_packanges '-D', *%w(exports-loader expose-loader file-loader url-loader imports-loader)
64
+ install_npm_packanges '-D', *%w(vue-loader vue-hot-reload-api vue-template-compiler)
65
+ end
66
+
67
+ no_tasks do
68
+ def install_npm_packanges(type, *packages)
69
+ run "npm i #{packages.join(' ')} #{type}"
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,30 @@
1
+ var config = {
2
+ resolve: {
3
+ extensions: ['', '.js', '.coffee', '.vue', '.json'],
4
+ alias: {
5
+ vue: 'vue/dist/vue'
6
+ }
7
+ },
8
+
9
+ module: {
10
+ loaders: [
11
+ {
12
+ test: /\.js$/,
13
+ loader: 'babel',
14
+ exclude: /node_modules/
15
+ },
16
+ { test: /\.vue$/, loader: 'vue' },
17
+ { test: require.resolve('vue/dist/vue'), loader: 'expose?Vue'}
18
+ ]
19
+ },
20
+ vue: {
21
+ postcss: [
22
+ require('autoprefixer')({
23
+ browsers: ['last 2 versions']
24
+ })
25
+ ]
26
+ }
27
+ }
28
+
29
+ module.exports = config;
30
+
@@ -0,0 +1,2 @@
1
+ require 'vuejs/webpack/rails'
2
+ require 'webpack-rails'
@@ -0,0 +1 @@
1
+ require 'vuejs/webpack/rails/version'
@@ -0,0 +1,8 @@
1
+ module Vuejs
2
+ module Webpack
3
+ # :nodoc:
4
+ module Rails
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vuejs-webpack-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Xiaohui Zhang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: webpack-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.9
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.9
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ description: Production-tested, JavaScript-first tooling to use Vuejs + Webpack within
56
+ your Rails application
57
+ email:
58
+ - xiaohui@zhangxh.net
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - lib/generators/vuejs_webpack_rails/install_generator.rb
64
+ - lib/generators/vuejs_webpack_rails/templates/vue.config.js
65
+ - lib/vuejs-webpack-rails.rb
66
+ - lib/vuejs/webpack/rails.rb
67
+ - lib/vuejs/webpack/rails/version.rb
68
+ homepage: http://github.com/xiaohui-zhangxh/vuejs-webpack-rails
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2.0.0
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 2.6.7
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: Vuejs & Webpack & Rails integration made easier
92
+ test_files: []