0

As part of the pub build process, I would like pub to copy a file from $PROJECT_ROOT/third_party/foo/foo.png to $PROJECT_ROOT/build/web/foo.png to make it accessible to my code at runtime. How can I configure pub to copy the file for me using pubspec.yaml?

Evan Kroske
  • 4,506
  • 12
  • 40
  • 59

2 Answers2

1

You can't. You can use for example Grinder and automate your build tasks with it. It makes it easy to invoke pub build and copying files with a few lines of Dart code.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
0

You can use symlink for that. It will be automatically copied during pub build to your build directory and will always be the same file as in your root directory during debug. You may symlink the whole folder or single file to your web folder.

pub does exactly the same with packages folder. In linux or macosx its quite easy using ln -s command. In windows, here is good explanation how to do that.

Mike
  • 738
  • 8
  • 12