Is it possible to pack third-party JS and CSS libraries along with my project assets?

I want to start using extraction tools like Minify , Uglify, or Closure to speed up the loading of my pages.

My project is based on several bulky libraries ( jQuery , Bootstrap , ...).

I am considering two options:

Option 1: Use an Official CDN

  • Minimize only my project files to one .cssand one .jsfile
  • Serve (reduced) core libraries from the famous CDN

It will look like this:

<script src="(my cdn)/myproject.min.js"></script>
<script src="(official cdn)/jquery.min.js"></script>
<script src="(official cdn)/jquery-ui.min.js"></script>
<script src="(official cdn)/bootstrap.min.js"></script>

<link rel="stylesheet" href="(official cdn)/bootstrap.min.css"></link>
<link rel="stylesheet" href="(my cdn)/myproject.min.css"></link>

Pros:

  • , CDN -, .

:

  • , HTTP- ( , 304 Not Modified), .

2:

  • + .

:

<script src="(my cdn)/myproject-and-libraries.min.js"></script>
<link rel="stylesheet" href="(my cdn)/myproject-and-libraries.min.css"></link>

:

  • HTTP-, .

:

  • jQuery Bootstrap -, .

( , ) CDN AWS CloudFront, CDN , , .

: ?

+5
1

.

, , . , .

HTTP- , . , HTTP- , - , , .

, HTTP- ( HTTP- ). .

, , , CDN, . , , -, , , (, Yahoo, 25% ), .

, . JavaScript , /, , , , JavaScript.

, , gzipping CloudFront, , , . , , . , .

CDN - , , , .

+2

All Articles