cables-gl / cables_docs

cables documentation docs.cables.gl
https://cables.gl/docs/docs
45 stars 16 forks source link

Include files used in CSS op in patch files manifest #860

Open TobyKLight opened 2 months ago

TobyKLight commented 2 months ago

Feature request

Any local URLS referenced in the CSS op are included in the files manifest.

Then these are automatically packaged and downloaded with exports.

I also notice that in the downloaded assets files are renamed 123456789_name.jpg In principle why not leave the folders in there? so it remains 123456789/name.jpg?

TobyKLight commented 2 months ago

Hmm actually what would be useful is an op that scanned any string for local file URLs and added them to the patch manifest. I have some strings that contain <img href="123456789/bla.png"> tags for use in html elements.

TobyKLight commented 2 months ago

More info: Files become untracked and linked to old patches when you are in a workflow where you are cloning your patch.

Regularly making a new clone of a patch to update release versions is very useful for showing a client "here's this weeks version".

steam0r commented 2 months ago

Regularly making a new clone of a patch to update release versions is very useful for showing a client "here's this weeks version".

we do this by exporting to different directories /preview/1, /preview/2 but always keep the same patch...also keeps you away from a lot of caching issues.

steam0r commented 2 months ago

Hmm actually what would be useful is an op that scanned any string for local file URLs and added them to the patch manifest. I have some strings that contain <img href="123456789/bla.png"> tags for use in html elements.

this is basically what the export is trying to do, it just gets really hard to find these urls, and then the files that are associated with that. if you do something like this you should use {{ASSETPATH}} in CSS or any op that uses inUrl ports (anything that let's you pick a file)...if you need to generate filenames, there are

https://cables.gl/op/Ops.Cables.AssetPathURL https://cables.gl/op/Ops.String.File.SwitchFile_v2

and the likes. to help the exporter know that you are talking about local files. make sure to export "all" assets in these cases.

for the feature request: how would a "manifest" help in this case and where would you/we put it?

TobyKLight commented 2 months ago

OK so the 'files manifest' already exists Yknow this thing

image

Basically the feature request is that assets referred to in CSS op (And TextureArray op since you merged the issue) are automatically tracked in this list so they can be exported.

Because it already handles that assets are 'referenced' from another patch and includes those in the ALL export. It's just a shame it currently misses that some assets are used.

pandrr commented 1 month ago

we dont want to parse css code, thats another complexity to add.

but you can use css variables to set those files via ops:

Screenshot 2024-09-23 at 17 20 25

this way the files are automatically included in the export...

i'll add a setCssVariableUrl op on dev.cables.gl then the concat will not be needed