New update has broke my workflow can't manually rename generated script


(Gordee McBride) #1

Hi, so I consider myself quite an advanced hype developer as I have a strong background in html5 and mobile app development but enough about me here is my issue.

after creating several hype projects for example say chapters of a book I will spit them out as html5 folders. I will then prep them to be placed inside an app by manually editing the html5 folders and combine them into 1. what I do is rename the index file to say ch1index, ch2index etc etc. inside the index I will change the name of the hype generated script in a similar style.
next I go to the generated script and change the name to match. after this I will rename the references to iframes to say ch1iframe etc and then change the iframes to match

doing all this means I can place all the resources in the one hyperesources folder which means no need for duplicate resources and memory saved.

So since the new update I can’t do this anymore. ignoring the iframe changes and keeping a project in it’s own folder as soon as I make changes to index and rename index_hype_generated_script.js the project now just shows a blank page. can anyone tell me what has changed and how I work around it.
Many thanks
Gordee


(Mark Hunte) #2

Hi it may be easier for some to help if we can see an example with your changes.

Also are you getting any errors in yhe console?


(Jonathan Deutsch) #3

There haven’t been any specific recent changes to Hype that sound like they would break what you are doing, especially if it is done manually (automating this could break due to changes in minified code in the _hype_generated_script.js).

As @MarkHunte asked, the best way to help would be to know if there are any console errors or to get a zip to see what you are exactly doing.


(Gordee McBride) #4

hi guys, thanks for coming back to me. sorry I never replied over the weekend but I was off site on another project. Anyway the console is giving me

ReferenceError: jQuery is not defined
jquery…min.js (line 21, col 1)

I can’t provide the project I am working on as it’s under an NDA however I have recreated the problem with an old project that has already been released. there are 3 examples. 1 is the original build with all changes including ref to iframe and it works
the second is the project untouched and working
the third is the issue with only the references and names for generated script changed. The files are too big to share here so here is a dropbox link


enjoy
Gordee


#5

This possibly refers to jQuery being called too late. i.e the code referencing the var jQuery is being called before the actual library is being loaded.

As for the rest … haven’t got time to look at it today but if no-one else chimes in then I’ll have a look.


(Gordee McBride) #6

I would agree with you DBear but why would there be no issue before changing 1 reference and file name?

actually I just went back to check as that jQuery issue also exists on the working copy so has nothing to do with the issue. it’s for a completely different piece of code embedded in the project


(Gordee McBride) #7

Solved. there is now a reference inside hype_generated_script that contains it’s own name. once this has been changed too all is well


#8

@jonathan can provide more detail about this, but here’s what’s going on here:

When you export, the document name, the JS filename, folder name, etc is all embedded within the generated JS file, which in turn instructs the browser where to look for all the assets required to load your document. This might have changed slightly in the last version, but it’s not something we expect users to need to rely on.

There’s a line that specifically specifies the name of the JS file, which you can find by searching for b.indexOf

In your broken version within the folder ERROR changed gnerated script ref, that line was:

d = null != b ? b.indexOf("index_hype_generated_script.js")

If you change it to:

d = null != b ? b.indexOf("ch1index_hype_generated_script.js")

I don’t recommend changing this variable as part of your workflow, because it may change in the future. Can you explain a bit more about your setup and tell me about the duplicated resources in your project? Loading the HYPE runtime multiple times should not cause performance issues but I would like to know if you have seen that.


(Jonathan Deutsch) #9

Actually you are correct, Hype 3.6 did make a change that breaks your particular case - specifically if the old name is contained in the new name (index_hype_generated_script.js in ch1index_hype_generated_script.js). That’s a fun edge case! While we don’t really support messing with the .js file, I’ll look into if there’s a better way around this since I could see other cases having issues.

Why don’t you just export as “ch1index” in the first place for each file? This would only mean you’d need to change the .hyperesources folder name?


#10

That’s what I thought :slight_smile: but I assumed there was a reason for this. I, personally would steer clear of messing with the intricacies of the output of Hype.

When exporting you could export with the specific name and then take the scripts and put them in one resources folder.

BTW I’m working on a CMS solely for Hype if anyone is interested. So that users can utilise many Hype projects and embed them easily into one site and also have some way of controlling content. I know Hype can be used to create a whole site but its power lies in creating animated content. So, I thought about taking those animations and finding a relatively easy way to combine them into a whole. Work in progress!


(Gordee McBride) #11

To be honest I was worried if I exported with the correct name in the first place there may be way more references to deal with inside other files but it is worth the experiment. I’ll give it a go next time


(Gordee McBride) #12

yup that’s what I discovered that fixed my issue


(Jonathan Deutsch) #13

I fixed this for the next release; thanks!