简体   繁体   中英

pub build to subdirectory?

Is it possible to build to a subdirectory within build ? So that everything that's linked in the Dart application code looks for the assets in a sub directory prefix?

Essentially I'm trying to combine two Dart apps... So assets in web are conflicting. Of course the symlinks in web/packages are different and/or could conflict as well.

I want to take the HTML code from the one main index.html and put it into the other application - that part fits together fine without conflict. I also want to then link the other dart2js compiled main.dart.js file... Again both Dart apps run without conflict side by side... But I run into issues with all the assets.

I'm also using angular.dart for this second project where the first is not. Due to that, it's not just as simple as changing a few <img src="img/example.jpg" /> to <img src="symlinked-path/img/example.jpg" /> ... I have within the Dart application various references to assets like HTML template partials, etc.

It's almost like as if I need some sort of <base> tag for just the parts I'm after. It unfortunately doesn't work that way, but that's kinda the best way I can describe what I'm after if it doesn't make sense yet.

So I was hoping that pub build had some options or perhaps even the transformer could output everything and have dart2js change things in the JS to point to some subdirectory under build. I could then symlink that.

Thoughts about merging two Dart apps?

Ok, I read: https://www.dartlang.org/tools/pub/assets-and-transformers.html#where-to-put-assets

Was a little confusing but I got it and think it'll work for my situation... I put a new asset directory alongside at the same level as my web directory and then pub build moved those files into a assets/my_package_name directory... Which I can symlink without conflict. So now nothing is in web other than my index.html file which I'm yanking the guts out of anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM