Install
nodeがないと怒られるのでnodejsをインストールする。
$ nvm install <version>
$ npm install -g yarn
5.1.0.beta1
をインストールし、rails new
する。
$ gem install rails -v 5.1.0.beta1
$ rails new rails-vue-sample --webpack=vue -O
いらないファイル消す
$ rm -rf app/assets/javascripts/
$ rm -rf app/assets/stylesheets/
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -3,9 +3,6 @@
<head>
<title>RailsVueSample</title>
<%= csrf_meta_tags %>
-
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
--- a/config/application.rb
+++ b/config/application.rb
@@ -21,5 +21,10 @@ module RailsVueSample
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
+
+ config.generators do |g|
+ g.assets false
+ g.jbuilder false
+ end
end
end
webpackのセットアップ
$ bin/rails webpacker:install
$ bin/rails webpacker:install:vue