-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Ready for Vue #107
Ready for Vue #107
Conversation
Nice! I am a big fan of vue so excited to have progress on this. And gj putting all that error messaging in the generator, future generations will thank you! I think what's done here is quite excessive for a generator though - it installs an entire Todo app into your Rails app.
Suggestion: Additional functionality beyond the above should be removed and made into a separate app template or a demo app. |
Thanks, appreciate the feedback. Will move the todo example to a separate app template. This edited PR is ready for merging. It now renders a simple "Hello Vue!" with app.vue and hello_vue.js I also set vue to latest stable version (2.1.10) because the latest (2.2.0.beta1) did not compile well. Update: Try Tried to replace url-loader with file-loader but image placed in .vue don't render. So url-loader was left default for now. |
config = File.read(config_path) | ||
|
||
# Module resolution https://webpack.js.org/concepts/module-resolution/ | ||
if config.include?("'vue$':'vue/dist/vue.common.js'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this won't be necessary anymore with Vue v2.2.x https://github.com/vuejs/vue/releases/tag/v2.2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ytbryan Will this disable my normal views and erb helpers? |
@ankitsinghaniyaz can you elaborate and if possible, show with some code? I don't get what is "this" |
@ytbryan I mean if I use webpack and vue configuration. Will I still be able to use Is there a sample app created using this? |
@ankitsinghaniyaz Yes, webpack configuration should not affect your existing erb view files. @ankitsinghaniyaz try |
@ytbryan I created a new app, but it will be awesome if I have some guidelines how to structure the code and how to mix it with normal rails templating. |
Hi @ytbryan great work. I am having trouble setting this up with a fresh Rails 5.0.2 application. After creating the application, I add webpacker gem and then bundle:
Then I run
At this point it seems that there is something wrong. For some reason this Yarn is not in the system. Anyway, I proceeded to install Vue with
The Vue examples are actually copied to
I proceeded to add
It seems |
Thanks @BigChief45. You forgot about the For production, you can also compile assets using From the readme:
Let me know if it works. Also, you can read Gaurav's article on getting started https://medium.com/statuscode/introducing-webpacker-7136d66cddfb#.kyrso4uuc (Especially Step 4 which you are missing) |
@ytbryan Thanks for your reply. Figured out a few things. I installed Yarn, updated Node, ran In config.x.webpacker[:dev_server_host] = '0.0.0.0' Then I run
Then in a separate terminal, I run the Rails server on port 8081. When I open in the browser I still get a similar error to before, but this time there is a different path in the error message:
I feel I'm closer this time, but not sure what else I'm missing here. |
This is not correct: Try with |
@renchap Thanks for chiming in. I tried using that configuration, and while I don't get errors anymore, the Vue component is not displaying the "hello" message. I am working on a cloud based development environment so I think the EditTried running the webpack dev server with Then changed the config.x.webpacker[:dev_server_host] = 'http://0.0.0.0:8080' Then started Rails in 0.0.0.0 and port 8081. No errors but still can't get Vue to show anything. |
@BigChief45 Can you open an issue instead? do you have the repo on github somewhere? Which cloud-based dev environment? Heroku? 😅 Because Anyway let's take this off this PR request thread. You can open an issue and we can fix it there. For future issues regarding vue (or react or angular), please open an issue instead. Thank you! |
@BigChief45 you can configure the host when launching
Then you need to change If you connect to your Rails app using for example |
This PR ships with Vue, its supported libraries & configuration which I reference partially from chrisvfritz's repo (https://github.com/chrisvfritz/rails-javascript-integrations/tree/vue-webpack)
It includes the classic <%= javascript_pack_tag 'hello_vue' %> and another <%= javascript_pack_tag 'vue_todo' %> example that demonstrates other capabilities of Vue found in chrisvfritz's vue-webpack branch.