stefanpenner / ember-app-kit

deprecated: see https://github.com/stefanpenner/ember-cli
MIT License
1.02k stars 231 forks source link

Is there a standard way of including other JS files? #257

Closed AxisOfEval closed 10 years ago

AxisOfEval commented 10 years ago

I just started to use EAK and really like how things are taking shape. I wanted to know is there is standard way of including 3rd party JS code?

For example, I have installed bootstrap using bower. The bootstrap files are in the vendor/bootstrap directory. Importing the LESS files and getting them built in the pipeline was easy to figure out. However, I am a bit clueless for the JS bit. Is there a standard way? Referencing stuff outside of the public directory in index.html might not work well in production.

I tried the docs site, didn't give me any clues either. Am I missing something?

MajorBreakfast commented 10 years ago

You can use normal javascript libraries by adding them to your app/index.html. I recommend adding them between ember-data and almond. If you use karma, you should add them to karma.conf.js, too. Most javascript libraries introduce globals. (i.e. jQuery's $) Add the globals you're using to .jshintrc, so you don't get linting errors.

ES6 style imports arn't supported right now (but they will in the future!).

stefanpenner commented 10 years ago

@MajorBreakfast good answer.

related work to improve this: https://github.com/stefanpenner/ember-app-kit/issues/90

erkarl commented 10 years ago

I can't seem to figure out how to add ArcGIS JS API (http://js.arcgis.com/3.7/) to my EAK project. (https://github.com/erkarl/ember-app-kit-arcgis/blob/master/app/index.html).

I'm getting a weird uncaught error and I'm kind of stuck debugging it. Any help would be greatly appreciated.

Error {src: "dojoLoader", info: 0} init.js:40
(anonymous function) init.js:40
(anonymous function) init.js:19
f init.js:15
q.signal init.js:19
async init.js:41
(anonymous function) init.js:41
src: dojoLoader init.js:41
info: 0 init.js:41
. init.js:41
Uncaught Error: Could not find module [object Object] loader.js:17
requireModule loader.js:17
(anonymous function)
stefanpenner commented 10 years ago

reopening so I remember to look into @erkarl's issue

stefanpenner commented 10 years ago

@erkarl our new loader may work correctly with this.

erkarl commented 10 years ago

@stefanpenner still getting the following output with the latest EAK version:

Uncaught Error: Could not find module [object Object] loader.js:14
requireModule loader.js:14
(anonymous function) svg.js:15
DEBUG: ------------------------------- ember.js:3461
DEBUG: Ember      : 1.4.0-beta.5 ember.js:3461
DEBUG: Ember Data : 1.0.0-beta.6 ember.js:3461
DEBUG: Handlebars : 1.1.2 ember.js:3461
DEBUG: jQuery     : 1.9.1 ember.js:3461
DEBUG: ------------------------------- ember.js:3461
Uncaught TypeError: Cannot set property '$locale' of undefined init.js:56
(anonymous function) init.js:56
ga init.js:32
(anonymous function) init.js:24
ha init.js:32
Ma init.js:24
c init.js:24
(anonymous function) init.js:56
ga init.js:32
(anonymous function) init.js:32
ha init.js:32
ea init.js:32
s init.js:34
(anonymous function)

Following this guide: https://developers.arcgis.com/javascript/jstutorials/

Could this have something to do with this: http://stackoverflow.com/questions/19290232/arcgis-3-5-issue-with-requirejs since we're using require.js (AMD)?

fsmanuel commented 10 years ago

@erkarl did you found a solution? can we close the issue.

erkarl commented 10 years ago

@fsmanuel I ended up rewriting my map in OpenLayers :-). Not really an elegant solution, but hey - it works!