meteorwebcomponents / synthesis

:fire: Synthesis is Meteor + Polymer
https://atmospherejs.com/mwc/synthesis
MIT License
28 stars 6 forks source link

src="[[src]]" not working #20

Closed aruntk closed 7 years ago

aruntk commented 7 years ago

I have an img src and the src is dynamic i.e. using a bound property [[src]]. When I change to the correct URL, it seems to be prefixing it with the current path i.e as if it was relative. Fetched url (from Chrome debugger network connections): "http://localhost:3000/imports/ui/components/asset/asset-thumb/https://diffdot-assets.s3.amazonaws.com/6jrizT8YEAKWJA2tv.jpg" I assume this is something to do with handling assets? What was wrong with putting assets in the public folders?

Raised by @edge0701

aruntk commented 7 years ago

Relevant code - https://github.com/meteorwebcomponents/synthesis/blob/master/packages/synthesis-compiler/synthesis-compiler.js#L269

aruntk commented 7 years ago

What was wrong with putting assets in the public folders?

Objective of asset handling is to enable relative image paths without altering the default usages(from public folder, remote urls etc). For example in vaadin-grid, a pretty popular polymer grid images are being used by relative paths. See https://github.com/vaadin/vaadin-grid/blob/master/vaadin-grid.html#L29.

I want synthesis to handle use cases like this. Here since the path is img/ic_check_black_24px.svg not /img/ic_check_black_24px.svg you cant even use public folder because the path will change according to the route.

If you are in route /example/route then the resultant url will be /example/route/img/ic_check_black_24px.svg (browser does this).

I want img/ic_check_black_24px.svg to change as /path/from/root/to/vaadin-grid/img/ic_check_black_24px.svg retaining /img/ic_check_black_24px.svg as such. Hope that is clear.