Git Product home page Git Product logo

vueonrails's Introduction

vue on rails

Vue for your favorite Rails products

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.

  • 🖖 Vue UI ready
  • 🐶 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
  • 🌎 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.


Getting Started

Create an empty Vue on Rails project by running with an application template:

rails new app -m https://vueonrails.com/vue -d postgresql

To browse the application template, it's here https://vueonrails.com/vue

Manual Installation

Create a Rails app with vue and webpack support.

rails new app --webpack=vue -d postgresql

Add this line to your application's Gemfile and run bundle

gem 'vueonrails'

note: vuejs gem was renamed to vueonrails

and run rails vue:setup to complete the installation


Getting Help & Contributing Back

Feel free to contribute back to Vue on Rails via pull requests. Below are some links that you may find useful.


Contact

📮 Bryan Lim [email protected]

Richard LaFranchi and I are writing a book Vue on Rails. If you are interested to be one of the early reviewers of our drafts, please email me.


MIT License

MIT

vueonrails's People

Contributors

m5o avatar pokvalitov avatar s-lee-kwong avatar ytbryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vueonrails's Issues

What's the purpose of this gem ?

Can I simply install webpacker and vue and have the features of vue within my rails project without this gem ?

How exactly is this gem helpful ?

I am asking only to understand and to make the best use of it.

You are using Vue on Rails 1.0.0.beta5 and it does not support webpacker 4.

When I try on an existent app:
rails vue:setup

and is giving this error

`
You are using Vue on Rails 1.0.0.beta5 and it does not support webpacker 4.

Please use the latest Vue on Rails (1.x) in your Gemfile:
  gem 'webpacker', '~> 4.x'
  gem 'vueonrails', '~> 1.x'

or switch back to webpacker 3:
  gem 'webpacker', '~> 3.x'
  gem 'vueonrails', '~> 0.x'


ruby '2.5.3'
gem 'rails', '> 5.2.3'
gem 'webpacker', '
> 4.x'
gem 'vueonrails', '~> 1.x'
`

turbolinks:load not working in PROD

My vue entrypoint js file that creates my vue component is surrounded by the code

document.addEventListener('turbolinks:load')

and this works fine in development mode but on production model the vue component is not created and I see a blank screen. But if I change that code to:

document.addEventListener('DOMContentLoaded')

then it works (vue component template is rendered) in production but in development it is only loaded first time but when I navigate to other parts of the site and come back the vue component is not rendered blank screen).

Is there something wrong with my code or turbolinks settings? Why does turbolinks:load not work in production?

I am using vueonrails version 1.0.0, rails 5.2.2

How do you test vue component in Vue on Rails?

In my erb I am calling a component department like
<%= vue_component, 'department', name: @department.name %>

How to test department component? Currently my jest test fails saying "erb is not defined". Is there any way to mock the call to erb function?

vuejs integration with rails/webpacker

Hey Bryan 👋

the rails core team is currently in preparation for Rails v5.1 with support for yarn and webpack lately.

It seams you're experienced with Vue.js and integrations with rails apps in general. With all your knowledge, do you think it's possible to also promote Vue.js within webpacker task, like DHH did with this presets tasks to use react.js.

I guess this would be make a lot of buzz and would be a great way to promote Vue.js 💪 with the next Rails update.

个别标签<dd>为什么不显示?

	window.onload = function() {
			new Vue({
				el: "#app",
				template: "<div>{{message}}<br><dd/></div>",
				data: {
					message: "adfadf"
				},
				components: {
					"dd": {
						template: "<h1>{{message}}</h1>",
						data: function() {
							return {
								message: "hello world"
							}
						}
					}
				}
			})
		}

其中的dd标签变量,在执行后,不会显示。
如果是程序设计里面有关键字的话,是否还有其它的标签也会这样不显示?

How to get Hypernova to render components?

Hi,
I've used the https://vueonrails.com/vue template to create a new project
Then after running rails vue:ssr, placed <%= render_vue_component "component.js" %> in the index.html.erb view .

No component is rendered on the page and all I get in its place is something like this:

<div data-hypernova-key="componentjs" data-hypernova-id="0fa5b134-2166-47f1-a4fd-fd337ff3962f"></div>
<script type="application/json" data-hypernova-key="componentjs" data-hypernova-id="0fa5b134-2166-47f1-a4fd-fd337ff3962f"><!--{}--></script>

Are there any other steps required to be able to render components using Hypernova with vueonrails ?

Error: Could not find i18n/index.js

rails vue:setup
Error: Could not find "/home/marcel/.rvm/gems/ruby-2.6.3/gems/vueonrails-1.0.0.beta5/lib/installs/../generators/templates/i18n/index.js"

Path is: home/marcel/.rvm/gems/ruby-2.6.3/gems/vueonrails- 1.0.0.beta5/lib/installs/../generators/templates/I18n/index.js (capital I in i18n)

How to run Vue on Rails in production mode?

Im running my application on Heroku and the environment is "Production" but im getting this warning

application-56fe55e….js:5 You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html

How can I use ruby variable inside my Vue component?

When calling vue_component in my erb, can I pass it a AR model instance: e.g.

  <%= vue_component 'project', project: @project %>

I tried but it did not work as to_json is called on @project and since it is unescaped, that markeup generated does not have all data . This works

  <% vue_component 'project, {name: @project.name, status: @project.status } %>

but I need to make erb call (in project.vue) for both name and status and also how do I handle associations, e.g. project has many employees and each employee has a first_name and last_name. Do I need to have a component for employee and call vue_component for each employee in a loop ans pass employee component?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.