2015-08-31 59 views
1

我有此路線播客。模型鉤子將getJSON調用到另一個域上的url。 當我建立生產,燼-CLI似乎認爲這是一個資產和手印它像這樣:ember cli構建指紋外部URL?

http://datafruits.streampusher.com/podcasts/datafruits-d31215e1fe906877c93d6ac2208c8da2.json 

我試圖將它添加到exclude屬性在指紋選項餘燼-CLI-build.js ,但我似乎得到了同樣的結果。我也嘗試了完整的網址。

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

是我的應用程序被稱爲「datafruits」如果有什麼關係呢。 這裏是前述播客路線:

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://datafruits.streampusher.com/podcasts/datafruits.json') 
    .then(function(data){ 
     return data.podcast; 
    }); 
    } 

我燼-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]); 
}; 

回答

2

broccoli-asset-rev庫,做指紋似乎想排除的文件名不帶擴展名。如果您使用以下,應該建立一個沒有指紋datafruits.json

fingerprint: { 
    //prepend: "//datafruitstest.s3-website-us-east-1.amazonaws.com/", 
    exclude: ['datafruits'] 
} 
+0

這並不工作,但現在我的應用程序JS不按手印,因爲我的應用程序被稱爲「datafruits」。 :( – freedrull

+0

[看他們的測試](https://github.com/rickharrison/broccoli-asset-rev/blob/master/tests/filter-tests.js#L94),這可能是一個錯誤,我會請至少報告一下,看看它是否真的不能與lib一起工作 – trabus

+0

因此,進一步看,我認爲這是['broccoli-asset-rewrite'](https://github.com/rickharrison/broccoli-資產重寫),它沒有考慮到文件與應用JS(它應該被指紋化)不一樣的事實,它在重命名路徑時似乎沒有考慮完整的文件路徑。 – trabus