Skip to content

Rails6 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
![vue on rails](https://vueonrails.com/assets/img/vueonrails.png)

> Vue for your favorite Rails projects
> Vue for your favorite Rails products

The Vue on Rails gem makes it easy to build Vue components on your Rails application.
The Vue on Rails gem makes it easy to build Vue components on your Rails products.

It uses Rails 5.x, Vue 2.x, Webpacker 4.x, Ruby 2.x, Node 11.x, Yarn 1.12.x.

- ❄️ Server Side Rendering using Hypernova
- 💎 Compatible with Rails 6/5/4 and Webpacker
- 🌎 Internationalization for component parts
- 🖖 Vue UI ready
- 🔨 Component generators and scaffolds
- 📦 Out of the box configuration
- ✂️ Specific-page Vue
- 🐶 Support pug
- 🤡 Jest test ready
- ✂️ Specific-page Vue
- 👷🏻️ Asset pipeline helpers
- 🎯 Simple state management
- 📦 Out of the box configuration
- 🔨 Component generators and scaffolds
- ❄️ Server Side Rendering using Hypernova
- 🗃 Easily migrate to Vuex state management
- 🐶 Support pug
- 👷🏻️ Asset pipeline helpers
- 🏎 Kickstart with our Vue on Rails application template at https://vueonrails.com/vue
- 🌎 Internationalization for component parts
- 💎 Compatible with Rails 6/5/4 and Webpacker
- 🏎 Kickstart with our application template at https://vueonrails.com/vue

It ships out-of-the-box configuration, component generators and other solutions to make life easy for both Vue and Rails.

Expand Down
18 changes: 12 additions & 6 deletions lib/installs/setup.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Check for the lack of .babelrc or webpacker 4
def check_version_and_babel
#should i check for evidence of webpacker:install?
File.exists?(Rails.root.join(".babelrc")) == false \
|| (Gem.loaded_specs["webpacker"].version < Gem::Version.new('4.x')) == false
(File.exists?(Rails.root.join(".babelrc")) == true) \
|| ((Gem.loaded_specs["webpacker"].version >= Gem::Version.new('4.x')) == false)
end

begin
Expand Down Expand Up @@ -33,10 +33,16 @@ def check_version_and_babel
"const alias = require('./alias/alias')\n", after: "require('@rails/webpacker')\n"

# Add *_pack_tag into application.html.erb This is essential for specific-page vue setup.
pack_tag = <<-eos
<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>
eos
if (Gem.loaded_specs["rails"].version >= Gem::Version.new('6.x')) # rails 6 has default javascript_pack_tag
pack_tag = <<-eos
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
eos
else # non-rails 6
pack_tag = <<-eos
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
eos
end

insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
pack_tag, before: " </head>\n"
Expand Down
17 changes: 12 additions & 5 deletions lib/installs/spv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
/<\/body>/, '<% end %>'

pack_tag = <<-eos
<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>
eos
if (Gem.loaded_specs["rails"].version >= Gem::Version.new('6.x')) # rails 6 has default javascript_pack_tag
pack_tag = <<-eos
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
eos
else # non-rails 6
pack_tag = <<-eos
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
eos
end


insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
pack_tag,
Expand All @@ -18,4 +25,4 @@

insert_into_file Rails.root.join("app/assets/javascripts/application.js").to_s,
vue_on_rails,
before: "//= require_tree ."
before: "//= require_tree ."
2 changes: 1 addition & 1 deletion lib/vueonrails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Vueonrails
VERSION = "1.0.0.beta1"
VERSION = "1.0.0.beta4"
end
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.