ember.js - Ember CLI app inside a Rails engine -
i'm making rails engine has /admin
route. i'd create admin interface ember cli.
i know rails automatically precompile static js/css live in engine's lib
dir, , load them when parent application mounts engine , visits route. however, i'd utilize ember cli build admin interface.
what way this? ideally i'd maintain ember cli builds out of repo.
my solution involved storing build of ember cli app in engine.
i wrote rake task runs ember build
, moves static dist
public/my-engine
directory, , merges public static assets host app's public folder.
here's task our particular project:
namespace :admin task :build dir.chdir('admin') sh 'ember build --environment=production' end # re-create dist public fileutils.rm_r 'public/front_end_builds' fileutils.mv 'admin/dist', 'public/front_end_builds' # move index out of public fileutils.mv 'public/front_end_builds/index.html', 'app/views/front_end_builds/admin/index.html.erb' end end
ruby-on-rails ember.js ember-cli rails-engines
No comments:
Post a Comment