更改Ember构建目录(dist文件夹),不带命令行标志

时间:2017-07-18 19:52:00

标签: ember.js ember-cli

我正在尝试将我的Ember项目构建到项目之外的目录中,并且对于将来的构建,我不想每次都使用命令行标记。 ember build --output-path=/not-dist对我有用,但我希望Ember自动添加标记。

    outputPaths: {
      app: {
        html: '../presentation/index.cfm',
        css: {
          'app': '../presentation/assets/ember-presentation-viewer.css'
        },
        js: '../presentation/assets/ember-presentation-viewer.js'
      },
      vendor: {
        css: '../presentation/assets/vendor.css',
        js: '../presentation/assets/vendor.js'
      }
    }

我按照ember-cli documentation尝试了此操作,但ember-presentation-viewer.css坚持要在dist目录中构建并放置所有其他路径。

有办法做到这一点吗?

2 个答案:

答案 0 :(得分:1)

转到package.json。更改scripts/build命令:

"scripts": {
    "build": "ember build --output-path=/not-dist"
},

从现在开始,运行:

npm run build

答案 1 :(得分:1)

您可以配置.ember-cli.js文件,以指定应始终包含在命令行构建中的标记(在较低的驼峰情况下),根据Ember文档中的this page。要更改输出目录,您需要添加以下行:"outputPath": "../../example-folder/presentation"

所以你的最终.ember-cli.js应该是这样的:

{
  /*
    Ember CLI sends analytics information by default. The data is completely
    anonymous, but there are times when you might want to disable this behavior.

    Setting `disableAnalytics` to true will prevent any data from being sent.
  */
  "disableAnalytics": false,
  "outputPath": "../../example-folder/presentation"
}
相关问题