lundi 31 août 2015

ember cli build fingerprinting external URL?

I have this route podcasts. The model hook calls getJSON to a url on a different domain. When I build for production, ember-cli seems to think this is an asset and fingerprints it like so:

http://ift.tt/1hsC0Cj

I tried adding it to the exclude property in the fingerprint option in ember-cli-build.js, but I seem to get the same result. I tried the full URL as well.

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    // Add options here
    fingerprint: {
      exclude: ['datafruits.json']
    }
  });

Yes my app is called "datafruits" if that has anything to do with it. Here is the aforementioned podcasts route:

import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
    willTransition: function(transition) {
      Ember.$("#podcastsModal").modal('hide');
    }
  },

  setupController: function(controller, model){
    this._super(controller, model);
    Ember.run.schedule('afterRender', this, function () {
      Ember.$("#podcastsModal").modal('show');
      var _this = this;
      Ember.$("#podcastsModal").on('hidden.bs.modal', function () {
        console.log("modal exited");
        _this.transitionTo('application');
      });
    });
  },

  model: function(){
    return Ember.$.getJSON('http://ift.tt/1if02Bs')
    .then(function(data){
      return data.podcast;
    });
  }

The rest of my ember-cli-build.js:

/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var ES6Modules = require('broccoli-es6modules');
var esTranspiler = require('broccoli-babel-transpiler');
var mergeTrees = require('broccoli-merge-trees');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    // Add options here
    fingerprint: {
      //prepend: "//datafruitstest.s3-website-us-east-1.amazonaws.com/",
      exclude: ['datafruits.json']
    }
  });

  // Use `app.import` to add additional libraries to the generated
  // output files.
  //
  // If you need to use different assets in different
  // environments, specify an object as the first parameter. That
  // object's keys should be the environment name and the values
  // should be the asset to use in that environment.
  //
  // If the library that you are including contains AMD or ES6
  // modules that you would like to import into your application
  // please specify an object with the list of modules as keys
  // along with the exports of each module as its value.
  app.import(app.bowerDirectory + '/bootstrap/dist/js/bootstrap.js');
  app.import(app.bowerDirectory + '/bootstrap/dist/css/bootstrap.css');
  app.import(app.bowerDirectory + '/moment/moment.js');
  app.import(app.bowerDirectory + '/fullcalendar/dist/fullcalendar.css');
  app.import(app.bowerDirectory + '/fullcalendar/dist/fullcalendar.js');
  app.import(app.bowerDirectory + '/jplayer/dist/jplayer/jquery.jplayer.js');
  app.import(app.bowerDirectory + '/jsTimezoneDetect/jstz.min.js');
  app.import(app.bowerDirectory + '/emojione/assets/css/emojione.css');
  app.import(app.bowerDirectory + '/emojione/lib/js/emojione.js');
  app.import(app.bowerDirectory + '/autolink/autolink.js');

  var phoenixTree = "./vendor/phoenix";
  var phoenixAmdFiles = new ES6Modules(phoenixTree, {
    format: 'amd',
    esperantoOptions: {
      strict: true,
      amdName: "phoenix"
    }
  });
  var phoenixTranspiledFiles = esTranspiler(phoenixAmdFiles, {});

  return mergeTrees([app.toTree(), phoenixTranspiledFiles]);
};




Aucun commentaire:

Enregistrer un commentaire