how to config ember.js and nodejs with ruby on rails? I am getting following error,
The Broccoli Plugin: [object Object] failed with:
Error: watch ENOSPC
First, get running with your Rails environment.
rails new myApp
Now, clean up the Gemfile.
gem 'rails', '4.2.0' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'ember-cli-rails'
You can install the dependencies with
We've got a generator from Ember gem. Let's create initializer file with that.
rails g ember-cli:init
By default, it’s configured to use an application called frontend that must live under
you may change it to
get '/*path' => 'frontend#index'
Create the controller FrontendController with index method. We'll need the view as well. Create a empty view for index method inside app/views/frontend/index.html.erb I would like to have a separate layout as well. You might want to use the default layout with other things. So create the file app/views/layouts/frontend.html.erb with below content.
<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>MyApp</title> <%= stylesheet_link_tag 'frontend' %> <%= include_ember_script_tags :frontend %> </head> <body> <%= yield %> </body> </html>
Don't forget to create the app/assets/stylesheets/frontend.css file and add it to Rails asset pipeline. Open config/initializers/assets.rb and add this line:
Rails.application.config.assets.precompile += %w( frontend.css )
We've the ember command from Node. We'll use that to initialize our Ember App.
ember new frontend --skip-git
This will create our app. Go to the frontend directory, we'd need to more npm package. also install :
`ember install ember-cli-rails-addo`
Okay, now start the server