Embed CSRF token into Ember CLI application

廉价感情. 提交于 2019-12-06 16:47:26

It is possible to implement your second idea. You need to specify options.outputPaths.app.html property of EmberApp in ember-cli-build.js:

const app = new EmberApp({
    outputPaths: {
        app: {
            html: 'index.aspx'
        }
    }
});

Doing this will result in Ember CLI writing index.aspx instead of index.html to filesystem:

You can read more about configuring output paths of your Ember CLI application in user-guide.

You can also dig directly in Ember CLI's ember-app.js source code to see if you can adjust options more to your needs.

Is it possible to make it environment-dependent? It works perfectly for production build. But it doesn't work for development since Ember CLI can not serve .aspx files. So it would be nice to overwrite output files for production builds only and use generic ones for development and test environments.

You can achieve this by checking value of app.env. So, in ember-cli-build.js, instead of passing outputPaths as argument, use following technique:

const app = new EmberApp();

if (app.env === 'production') {
    app.options.outputPaths.app.html = 'index.aspx';
}

This way you still get index.aspx in dist/ when building for production, but development and test environments' outputPaths options are untouched and live development/testing works.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!