jeudi 1 octobre 2015

Importing vendor JS file into Ember-CLI route file

I have an Ember CLI project, and one of my routes starts like:

import Ember from 'ember';
import Activity from '../models/activity';

var ACCESS_KEY = gOptions.access_key;

export default Ember.Route.extend({
...

I have a file vendor/local_config.js that contains machine-specific information, and is in the .gitignore to be omitted from the repository. It contains:

var gOptions = {
    access_key: 'abcde'
};

In my ember-cli-build.js file, I have imported this file like so:

app.import('vendor/local_config.js');

Running this application, everything works perfectly. The gOptions is universally available.

However, JSHint complains:

routes/activities.js: line 4, col 25, 'gOptions' is not defined.

I'm very new to Ember - what is the preferred method for updating my route to ensure that the vendor-provided classes are properly resolved/detected when JSHint is examining my routes/models?

Or: Is there a superior/Ember-like way of providing locally-defined environment variables, that should not be shared to a team?




Aucun commentaire:

Enregistrer un commentaire