Non-minified script


(David) #1

Is there a way to have Hype NOT minify the *_hype_generated_script.js? I am trying to integrate my Hype animation into Angular and I’m thinking about putting the script in a directive, but it would be easier if it wasn’t minified.


#2

There was an interesting conversation about Hype JavaScript here… Is there a Physics API? 🤔 …it’s a long thread, so here’s the related part… Is there a Physics API? 🤔

The Hype JavaScript is not just minified. It’s encapsulated too.


(David) #3

@Photics I would expect there to be some 3rd party libraries inside their library. They can still provide un-minified library (with 3rd party libraries still minified).

Tumult,
This would help people understand exactly what is going on with their animations and possibly help with support - if we could see the code, maybe we could help solve problems or make better suggestions. Better yet - you should open source the library. I would contribute in a heartbeat! Granted, you would still have full control over what gets merged.

Think about it.


#4

Did you read the thread? There’s a great behind-the-scenes look into Hype – how they handled at least one third-party library and how to view the un-minified code.


(Jonathan Deutsch) #5

There is a way, but it probably isn’t quite what you want :smile:. The *_hypegenerated_script.js file is pretty minimal and only includes code for loading in the Hype Runtime along with JSON data which represents the document contents/scenes/animations/etc. The JSON data is just about as impenetrable as minified code. Also, it is really only partially non-minified; there are several steps we do to reduce code size even before running it through a minifier at build time for Hype.

If you want to look at the * _hypegenerated_script.js before your data has been added to it, you can do it via control-clicking on the Hype application and choosing Show Package Contents and navigating to Hype2.app/Contents/Resources/DocumentLoader_Template.js. In that folder is also HYPE.thin.js and HYPE.full.js (which don’t change based on data).

The final way is completely unsupported and totally not recommended, but you can run this command in the Terminal:

defaults write com.tumult.Hype2 UseFullHypeJSTemplate -bool YES

When outputting, it will use unminified versions. We use this internally for debugging. Do not use it for any production documents (re-run the command with a NO in place of a YES to change it back).

As @photics mentioned the other thread talks about this a bit, but we basically don’t use third party libraries, minus a snippet of code here and there. Even Matter.js that we use for Physics isn’t wholesale and modified a bit to fit within Hype and to remove parts that aren’t necessary.

I’ve often thought about open sourcing (well beyond the fact that the source is totally available in the app package), but haven’t done so for a few reasons. Primarily is that adding any type of API would be very constricting to the development of our app. When there’s API, there’s a contract that cannot be broken, which can often get in the way of adding new features. We want animators/graphic designers to have any cool feature at their disposal and are still very early on to understanding what this all could be, so the notion of a solidified API is a bit tough to realize. Some features can completely flip the runtime on its head, so maintaining an API throughout those changes can be a nightmare. Also, file size is very important to us. Exposing an API would bloat the runtime quite a bit since those symbols cannot be minified. While outside contributions could be highly welcome, we’d also have to always make sure they are compatible with the app… Our mission is more to develop a great app than a great JavaScript library; nearly everything is driven by features we want in the application or animation capabilities which need to go hand-in-hand.

So I’m not ruling it out - there are tons of benefits… but that’s why we haven’t thus far (and don’t have specific plans to do this in the future). Yet all feedback counts and it is good to know this is wanted!


I Need The Non-Minified Version Of The Code