LoginSignup
0
0

More than 5 years have passed since last update.

【Rails】rails5.1betaでvuejsを試すための備忘録

Posted at

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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0