Make JavaScript and CSS External

The Benefits of External CSS and JavaScript

When a website is being created, web developers are posed with many different options and considerations that can affect how pages are displayed, and how fast they load. One of those considerations is deciding whether they want to write the CSS code, along with the JavaScript, into the HTML of the page itself. This helps to maintain continuity across pages and reduce the number of HTTP requests, but also increases the size of the page.

Additional Considerations for External JavaScript and CSS Files

Another option for improving web page performance is making JavaScript and CSS external. What this means is that of instead of downloading all the CSS and JavaScript documents each time a visitor hits your web page, you set the JavaScript and CSS as external documents, and make use of caching through the browser. This helps to reduce the number of HTTP requests and size of the HTML documents. Situations where you would want to implement external JavaScript and CSS include situations where you reuse the same scripts and stylesheets in documents, or cases where users view multiple pages per user session, and you can cache those for faster page load times. Examples of where you would not want to make JavaScript and CSS external would be in situations where specific pages have only few visits per session, like a home page.

lighthouse

Lighthouse

Lighthouse is an open-source tool that is used to run an audit against your web pages and provides scores and suggestions for improving page performance, accessibility, SEO, and more.

pagespeed

PageSpeed Terms

PageSpeed Insights is a tool created by Google that reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.

yslow

YSlow

YSlow is an open-source website analysis tool that can be used to identify web page performance issues. Learn more about the YSlow to enhance your web pages and the user experience.