twinejs icon indicating copy to clipboard operation
twinejs copied to clipboard

Allow story authors to provide material to be included in the head of the story file

Open david-donachie opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Story authors must wait until a story is entirely loaded (including the story format) before being able to load content, such as external fonts or preloaded images, that would be best loaded in the document HEAD as the rest of the game loads. Similarly, there is no way for a story author to insert content (such as Google Analytics scripts) that only works in the document HEAD.

It has been suggested that this is a compiler issue, rather than a story format issue, since story formats are not loaded until after the point where head content should have been inserted.

My particular issue was to do with styling the loading screen in SugarCube (which you can't easily do, since the screen loads before any part of the user-content), but it's a wider problem.

Describe the solution you'd like.

Add a new section to the Story menu "Head Content" that will allow you to insert content into the head of the compiled file. It's content would probably be raw HTML

Describe alternatives you've considered.

I initially considered this something a StoryFormat could do, and suggested various solutions on a SugarCube issue, but the problem applies equally to all StoryFormats.

It's also the case that tweego can handle this easily by marking a stylesheet or script as head content, but I feel it should be possible to use the Twine application to do the same without having to resort to external compilers or manual editing.

Additional context on this suggestion.

No response

Presubmission checklist

  • [ ] I am interested in working on code that would implement this feature request. (This is not required to submit a suggestion.)
  • [X] I have done a search and believe that an issue does not already exist for this idea in the GitHub repository.
  • [X] I have read and agree to abide by this project's Code of Conduct.

david-donachie avatar Nov 29 '22 11:11 david-donachie

I'm going close #164 as a duplicate of this because I think this has a better description of use cases, etc. FWIW, Google Analytics recommends putting its tag after the <head> section which would be potentially even more confusing to implement. But I get that this is just one example use case.

klembot avatar Dec 02 '22 02:12 klembot

Maybe add a way to set the FavIcon of the generated HMTL per Story.? Didn't know if this warranted a new Issue

Amathele avatar Jan 11 '23 08:01 Amathele