javascript - Efficiency of using php to load scripts? -
i have website that's 10-12 pages strong, using jquery/javascript throughout. since not scripts necessary in each , every page, i'm using switch
statement output needed js on given page, reduce number of requests.
my question is, how efficient that, performance-wise ? if not, there other way selectively load needed js on page ?
this may not necessary @ all.
bear in mind if caching set up, embedding javascript take time on first load - every subsequent request come cache.
unless have big exceptions (like, specific page using huge js library), consider embedding @ times, maybe using minification in 1 small file.
i don't see performance issues method using, though. after all, it's deciding whether output line of code or not. use whichever method readable , maintainable in long term.
Comments
Post a Comment