Is there any harm in using the min version? I’m just wondering if it’ll be faster, take up less memory, be faster to download…?
1 Like
- “p5.js” - use for development:
<script async src=https://Unpkg.com/p5></script>
<script defer src=sketch.js></script>
- “p5.min.js” - use for deployment:
<script async src=https://cdn.JsDelivr.net/npm/p5></script>
<script defer src=sketch.js></script>
4 Likes
hmm what do you mean by development? Do you mean that while I’m working on a project in my own IDE, I should be using p5.js and when I decide to host my sketch on a webserver, I should use p5.min.js?
Exactly that! A minified library is harder to debug but faster to download.
1 Like
async waits for the target file to download before it continues, correct?
- The opposite of it! It won’t await for anything!
- Use
async
for “p5.js” only if you’re not using add-ons for it! - Otherwise use
defer
, which it is much safer.
2 Likes
Another related question.
Should the p5.min.js file be on your web server or should you link to it?
So this:
<script async src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js"></script>
OR
<script async src="p5.min.js"></script>
and why?
I guess either is OK.