Unable to deselect certain files during Advanced Export

I’m working on add a PWA capability to my website and more importantly, offline support. I don’t want my full website to get cached, because some of the functionality would be broken as it needs internet and also, that would take quite an amount of storage on the user’s device. Thus, I created a seperate ‘Offline’ scene (or a web-page in my case). Now, I just want to export the ‘Offline’ scene and thus, I’m using ‘Advanced Export’. However, in the configurator for the export, some of the files are already chosen for me. I understand that some of those files are the ones that I have used on my scene, but, there are some files (some extensions, like .json, .webmanifest, etc.) that cannot be deselcted even though they’re not used in the scene. Now, because they get exported in the scene generated javascript, I also have to add them to get cached in my service-worker.js. It’s not a very big deal as the files are just a few KBs, might total to around 150KBs, but, when caching resources on the user’s storage, it’s always better to keep it minimum.

So, I’d like to export only the assets that I need. Or is it safe to remove the non-required assets from the scene generated javascript after the export?

If you have a file in your resource library, it will be shown in that Advanced Export panel -- so if you don't want to include them in your export, you should delete them from your resource library.

To avoid having them included in that Advanced Export panel but still access them, you could upload them to your server and just include references to them in your <head> area with regular HTML code. That way, it won't be a 'resource' in Hype's understanding of the word and you won't see them during export.

If I'm misunderstanding things could you send an example + Hype document?

Well, that's the case in normal HTML5 export, I guess. We just choose to export and the location, and Hype exports the entire thing. However, in Advanced Export, we get a choice to export only the files that we need.

I'm talking about this:

SharedScreenshot

In this screenshot, there are some files from my Resource Library. My situation goes on below:

Now, I have used the file Dark.svg on the chosen scene, and (probably) that's why, I can't deselect it. Okay, I understand that.

I've used the form-submission-handler.js in the document (on some other scene, not this one), but, it has to go in the <head>. This is okay, too.

The other files like Edited.jpg, Egg.mp4, etc. are used in the document, just not this scene. However, I'm still getting an option to choose if I want to include it in the export of the current scene. Everything still fine, rather this is the perfect scenario. I get to choose it all.

But, the browserconfig.xml is an example of a file that's neither used in this or any other scene. It does go in the <head>, but, that's not the point. Specific file types like .json, .webmanifest, etc. are not de-selectable during the Advanced Export (even if they do not go in <head>. If images and videos can be deselected, why not these files? I don't mind keeping them in the export, but, when my sw.js begins caching all the other files that I've mentioned, it succeeds. However, when the user actually goes offline and the webpage reloads, the browser isn't able to load anything because the scene-generated-javascript makes references to these 'non-required' files and those files aren't available in the cache.

I'll try to add an example document soon.

Edit:

My other example document from yesterday also has the same problem: https://forums.tumult.com/uploads/short-url/hMGVjIqm6EuQZMcRFYEy4rxRW9m.zip

Even when I'm selected a single scene to export, it's giving me the files not required by it also.

I looked at what was going on and found a “todo” note in the code about this.

This is a bug, or more specifically a missing feature in that the Advanced Export doesn’t yet have a notion of a “default on” state for an optional resource. Right now it is either required (checked and disabled) or not detected as used (unchecked and enabled). Because we can’t be certain about some types of resources like the ones you are using, we have those set as required in lieu of another “assumed used” state that would be checked and enabled.

1 Like

So, is it fine to remove their references from the scene-generated-javascript, or would you recommed caching those unnecessary files?

To clarify, you are referring to the fact that they will still be included in the app cache mainfest file? I’m not really clear on what you are asking, but if you manually remove them after the export (in the finder), then you will also need to manually remove them from the manifest (in a text editor) otherwise there will be issues.

1 Like

That more or less charifies it. Thanks.

1 Like