vue_rails 0.1.1 → 1.0.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 +4 -4
- data/lib/generators/vue/install_generator.rb +2 -1
- data/lib/vue_rails/asset_finder.rb +11 -3
- data/lib/vue_rails/renderer.rb +6 -0
- data/lib/vue_rails/version.rb +1 -1
- data/vue_ujs/environment_with_ssr.js +35 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ce1fc3479bd7e217c1d9ac459aaa1543f7aa13e2898dde049c8e7625de8e8fb
|
4
|
+
data.tar.gz: da670c878e6e1c92aa554d65663cfbfa79069583c6578b3b4bc7623e6f5f7253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 509844941163539a2427895838fbdfab8f09a752e345074548bacf477e26f732f6884a07ca362919d341185f06b6c6de81e954d8d0682c14d4cea917ac8b88bc
|
7
|
+
data.tar.gz: a4ba967c51e6277ee1c756df27724bdb557cf87514a13d28eec11f626afe7b57c60329c81b97511876e2ad03ec184fbbeeb784864c0c5510a6d6627350b10cd5
|
@@ -24,7 +24,8 @@ self.RailsVueUJS = RailsVueUJS;
|
|
24
24
|
remove_file "#{javascript_dir}/app.vue"
|
25
25
|
remove_file "#{javascript_packs_dir}/hello_vue.js"
|
26
26
|
template "vue_ujs/hello.vue", "#{javascript_dir}/vue_components/hello.vue"
|
27
|
-
|
27
|
+
template "vue_ujs/environment_with_ssr.js", "#{Rails.root}/config/webpack/environment_with_ssr.js"
|
28
|
+
`yarn add vue-server-renderer null-loader`
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
@@ -91,9 +91,17 @@ module VueRails
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
94
|
+
if MAJOR < 4
|
95
|
+
def output_path
|
96
|
+
# Webpack1 /:output/:entry, Webpack3 /public/:output
|
97
|
+
config.respond_to?(:output_path) ? config.output_path : 'public'
|
98
|
+
end
|
99
|
+
else
|
100
|
+
def output_path
|
101
|
+
config.public_output_path
|
102
|
+
end
|
97
103
|
end
|
104
|
+
|
105
|
+
|
98
106
|
end
|
99
107
|
end
|
data/lib/vue_rails/renderer.rb
CHANGED
@@ -4,7 +4,13 @@ module VueRails
|
|
4
4
|
class Renderer
|
5
5
|
GLOBAL_WRAPPER = <<-JS
|
6
6
|
var global = global || this;
|
7
|
+
global['process'] = global['process'] || {}
|
8
|
+
global['process']['env'] = {
|
9
|
+
VUE_ENV: 'server',
|
10
|
+
NODE_ENV: 'production'
|
11
|
+
}
|
7
12
|
var self = self || this;
|
13
|
+
var window = undefined;
|
8
14
|
JS
|
9
15
|
|
10
16
|
CONSOLE_POLYFILL = <<-JS
|
data/lib/vue_rails/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
const { environment } = require('@rails/webpacker')
|
2
|
+
const { VueLoaderPlugin } = require('vue-loader')
|
3
|
+
const vue = require('./loaders/vue')
|
4
|
+
|
5
|
+
environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
|
6
|
+
|
7
|
+
environment.loaders.prepend('vue', vue);
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
toWebpackConfig () {
|
11
|
+
return [webpackConfig, webpackConfigForServer]
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
let webpackConfig = environment.toWebpackConfig();
|
16
|
+
let webpackConfigForServer = Object.assign({}, webpackConfig);
|
17
|
+
let _entry = Object.assign({}, webpackConfig.entry);
|
18
|
+
webpackConfig.entry = {};
|
19
|
+
|
20
|
+
Object.keys(_entry).forEach((entry_key) => {
|
21
|
+
if (entry_key === "vue_server_render") {
|
22
|
+
let _module = Object.assign({}, webpackConfig.module);
|
23
|
+
_module.rules = Object.assign([], webpackConfig.module.rules);
|
24
|
+
_module.rules.unshift({
|
25
|
+
test: /\.(c|sa|sc)ss$/,
|
26
|
+
loader: 'null-loader'
|
27
|
+
});
|
28
|
+
webpackConfigForServer.module = _module;
|
29
|
+
webpackConfigForServer.entry = {};
|
30
|
+
webpackConfigForServer.entry[entry_key] = _entry[entry_key];
|
31
|
+
webpackConfigForServer.devServer = {}
|
32
|
+
} else {
|
33
|
+
webpackConfig.entry[entry_key] = _entry[entry_key];
|
34
|
+
}
|
35
|
+
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vue_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 纪亚荣
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/vue_rails/version.rb
|
125
125
|
- lib/vue_rails/view_helper.rb
|
126
126
|
- vue_on_rails.gemspec
|
127
|
+
- vue_ujs/environment_with_ssr.js
|
127
128
|
- vue_ujs/hello.vue
|
128
129
|
- vue_ujs/vue_ujs.js
|
129
130
|
homepage: https://github.com/jiyarong/vue_rails
|