在没有命令行标志的情况下更改 Ember 构建目录(dist 文件夹)

Change Ember build directory (dist folder) without command line flags

我正在尝试将我的 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 目录中构建所有其他路径。

有办法吗?

前往 package.json。更改 scripts/build 命令:

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

从现在开始,运行:

npm run build

您可以根据 Ember 文档中的 this page 配置您的 .ember-cli.js 文件以指定应始终包含在命令行构建中的标志(小驼峰式) .要更改输出目录,您需要添加以下行:"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"
}