What are the benefits of using an external javascript file? I just canβt understand this, I see that large sites use them only a few times instead of server ones. Is it just for caching?
If this is a matter of clean code and separation of concerns, then you can still enable it from the server in html. For example, I use SMARTY, and I can just include the file {include file='javascript.js}inside <script></script>. If this is for performance, I see nothing but an additional HTTP request making the external file slower. I'm sure I have to miss something, because all the big sites still do it.
Is it due to file caching? my javascripts are dynamic and should not be cached anyway.
can someone help me to make the right decision to choose what to do with my javascript files.
ps: can a 1.5K user create a tag for external javascript?
source
share