dimanche 11 janvier 2015

A way to include a CLI add-on component inside a Rails project with Ember 1.x

I have been reading and watching a lot of videos on Ember-CLI, ES6 modules, Broccoli, etc, trying to understand how the new ES6 modules can be used, deployed and shown in browsers.


I am aware of DockYard's es6_module_transpiler-rails, and I have looked at an example project, which does kind of what I need, but not really.


Here's my situation:


I have an Ember 1.x app. I have installed the ember-google-map component into the application using NPM. The package includes a bunch of ES6 js modules + templates, etc, as well as a bunch of dependencies, such as ember-cli, etc.


I want to use the component in my Ember 1.x app, as it has some functionality I don't want to re-create. Is there a way to set up my Rails + Ember app to automatically transpile all the necessary js files and their dependencies and include the new file(s) in app, so that it runs in the browser? I know the DockYard gem above can do application files that are suffixed with .es6, but this is a different situation, since I am trying to do this with an imported component that obviously doesn't follow the same convention.


If it's not possible to wire it all up in my app, is there a way I can transpile the component directory manually into one or more files, so I can include them in my project? I have tried doing this using es6-module-transpiler, but kept running into issues, such as missing module import errors, etc.





Aucun commentaire:

Enregistrer un commentaire