vuejs-webpack-rails 0.0.2 → 0.0.3

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: 68804d057121f1ff6d2567ef881255cd368facde
4
- data.tar.gz: b605d3b15d80a2e97d49404510b22fc6de2b6fb4
3
+ metadata.gz: 69f4d2778f240f33f5e14dcfdabe1f5dcbf5dc8e
4
+ data.tar.gz: a699370aee3bfd29ea4274d3ce6ca5a52f702786
5
5
  SHA512:
6
- metadata.gz: e47af650aac9ad66f2a7abac080054893d614e9d740ba92b55616a25fb6418a26e04fcff967765bdcfc0a22458b8033f982e5865387c6e4a60603593612f2550
7
- data.tar.gz: d6bbf72bc4ff4e5dc5187cbc3736b4d499248f3f701219418dcf85f44526739c526d142ae61886a98ed34184d536df26e2c5d2a737456e55ef13d3eef3c141e7
6
+ metadata.gz: 3b7e9c4b2616b1d30553e3249782d3e1abbd205b77f3c25aad45ac40cc93e9bb6a7fcdbac0cca75540a4f92e6c92720ba7dae21973150651fc8a135ebe460959
7
+ data.tar.gz: 82440dcfb5a54e5743668bcfa8c2c5903347d0d17a3057ad1854dfac05aae4b732068de1733129f3af34fd9fc624f3dc3fb6f34f46722fbd70175eae936b0ebb
@@ -9,8 +9,9 @@ module VuejsWebpackRails
9
9
  generate "webpack_rails:install"
10
10
  end
11
11
 
12
- def copy_vue_config
13
- copy_file 'vue.config.js', 'config/vue.config.js'
12
+ def copy_files
13
+ directory 'config'
14
+ directory 'webpack'
14
15
  end
15
16
 
16
17
  def modify_webpack_config
@@ -59,7 +60,7 @@ module VuejsWebpackRails
59
60
  end
60
61
 
61
62
  def install_packages
62
- install_npm_packanges '-S', *%w(vue lodash)
63
+ install_npm_packanges '-S', *%w(vue lodash vue-resource)
63
64
  install_npm_packanges '-D', *%w(webpack-manifest-plugin extract-text-webpack-plugin webpack-merge)
64
65
  install_npm_packanges '-D', *%w(babel-core babel-loader babel-runtime babel-plugin-transform-runtime babel-preset-es2015)
65
66
  install_npm_packanges '-D', *%w(coffee-loader coffee-script)
@@ -68,6 +69,22 @@ module VuejsWebpackRails
68
69
  install_npm_packanges '-D', *%w(vue-loader vue-hot-reload-api vue-template-compiler)
69
70
  end
70
71
 
72
+ def print_message
73
+ say <<-MESSAGE.strip_heredoc
74
+
75
+ == Vuejs + Webpack + Rails ==
76
+
77
+ 1. Please add below line to your layout(app/views/layouts/application.html),
78
+ this is loading Vue assets from Webpack web server in development
79
+
80
+ <% = javascript_include_tag *webpack_asset_paths('application') %>
81
+
82
+ 2. Now add your own Vue components to webpack/components/<your_component>,
83
+ require your component from webpack/components/index.js
84
+
85
+ MESSAGE
86
+ end
87
+
71
88
  no_tasks do
72
89
  def install_npm_packanges(type, *packages)
73
90
  run "npm i #{packages.join(' ')} #{type}"
@@ -0,0 +1,10 @@
1
+ require('./concerns');
2
+ require('./components');
3
+
4
+ // in Rails, put below code to app/assets/javascripts/application.js
5
+
6
+ // $(function(){
7
+ // new Vue({
8
+ // el: '#app'
9
+ // });
10
+ // })
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <h1>Hello <slot></slot></h1>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ mounted () {
8
+ console.log('Your first component Hello is mounted');
9
+ }
10
+ }
11
+ </script>
12
+
13
+ <style scoped>
14
+ h1 { color: blue; }
15
+ </style>
@@ -0,0 +1,3 @@
1
+ var Vue = require("vue");
2
+ Vue.components = {};
3
+ Vue.components.Hello = Vue.component('hello', require("./hello"))
@@ -0,0 +1,13 @@
1
+ var Vue = require('vue')
2
+ Vue.use(require('vue-resource'))
3
+
4
+ // Vue.http.options.root = '/api';
5
+ Vue.http.interceptors.push({
6
+ request: function (request) {
7
+ Vue.http.headers.common['X-CSRF-Token'] = $('[name="csrf-token"]').attr('content');
8
+ return request;
9
+ },
10
+ response: function (response) {
11
+ return response;
12
+ }
13
+ });
@@ -2,7 +2,7 @@ module Vuejs
2
2
  module Webpack
3
3
  # :nodoc:
4
4
  module Rails
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.3"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vuejs-webpack-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiaohui Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-15 00:00:00.000000000 Z
11
+ date: 2016-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -61,7 +61,12 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - lib/generators/vuejs_webpack_rails/install_generator.rb
64
- - lib/generators/vuejs_webpack_rails/templates/vue.config.js
64
+ - lib/generators/vuejs_webpack_rails/templates/config/vue.config.js
65
+ - lib/generators/vuejs_webpack_rails/templates/webpack/application.js
66
+ - lib/generators/vuejs_webpack_rails/templates/webpack/components/hello/index.vue
67
+ - lib/generators/vuejs_webpack_rails/templates/webpack/components/index.js
68
+ - lib/generators/vuejs_webpack_rails/templates/webpack/concerns/http.js
69
+ - lib/generators/vuejs_webpack_rails/templates/webpack/concerns/index.js
65
70
  - lib/vuejs-webpack-rails.rb
66
71
  - lib/vuejs/webpack/rails.rb
67
72
  - lib/vuejs/webpack/rails/version.rb