[go: nahoru, domu]

Skip to content

Commit

Permalink
Rails6 (#31)
Browse files Browse the repository at this point in the history
* fix issue with latest webpacker

* small logo.png and edit readme.md

* finally fix the check. Check if .babelrc don't exist!
  • Loading branch information
ytbryan committed Jun 14, 2019
1 parent f4a2d3d commit 90a2e4e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 23 deletions.
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.

0 comments on commit 90a2e4e

Please sign in to comment.