如何在Dart / Pub配置中更改源目录?

时间:2014-11-18 12:28:47

标签: dart dart-pub

我在Dart文档中找不到答案。

My application的服务器端由Spray驱动,按照惯例,静态文件存储在/webapp文件夹中。当我尝试构建Dart项目时,我得到以下错误

C:\work\externals\dart-sdk\bin\pub.bat build --mode=release
Your package must have a "web" directory, or you must specify the source directories.

如何将其从web更改为webapp?我的pubspec.yaml看起来像这样

name:  dart_spray_example
description:  A sample Dart/Spray application

dependencies:
  browser: any

这是我现在的应用程序布局

enter image description here

1 个答案:

答案 0 :(得分:3)

您只需将其作为附加参数传递。

pub build --mode=release webapp

但我希望这样做会有麻烦,因为只有一些顶级目录名符合pub package layout convention

pub build --mode=release example

没关系。

web用作源目录并将生成的输出移动到webapp可能更容易。我知道这可能会在开发过程中引起问题,但我希望更容易修复开发设置而不是构建设置。

使用像Angular和Polymer这样大量使用变换器的框架强烈依赖于包布局约定。

相关问题