New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
making keyshapejs code smaller #9
Comments
I don't think there's any easy way to remove unused functions. The only way would be to try to remove unused API methods, such as cancel() or markers(), and see if it still works. Then, you would also have to minify the library yourself. If you don't need KeyshapeJS API, then you can try to export CSS animations from Keyshape. They are smaller than KeyshapeJS animations. |
I hope this isn't tool late, but one way to get the files smaller is to use an external KeyshapeJS file for all the animations. It will load the library only once and the actual SVG file size is small. You can use external KeyshapeJS by changing 'JS Library:' to 'External' in the Keyshape export dialog. |
Even when selecting "External" in the export options, still a problem persists. Each individual SVG redownloads the script on its own when appended to the DOM. You can see this behaviour showing in the "Network" inspector tab when at least 2 keyshape SVG are present in the document. Is there a buil-in solution to that problem? |
I attempted commenting out If only the SVGs had access to the global variables. Ensuring KeyshapeJS gets loaded before the SVGs would solve the problem. Any clue how to achieve that? |
@wwwonka Web browsers should cache the KeyshapeJS library, if your server allows it. |
You are right. Now that I tweaked my dev settings it is in fact loading from the cache. However, here is an interesting solution:
That way, the SVGs don't have to look for any cache as the KeyshapeJS object is already declared. The one part that is missing now is setting the initial state, as I don't have a |
@wwwonka Do you mean the |
hello,
I am using it for a very basic animation, mostly just postion, opacity, fillcolor and size changes.
I am needing to make all the files as small as possible. Would you recommend a way to remove unused functions from the main keyshapejs file?
The text was updated successfully, but these errors were encountered: