TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: CDN or npm?

2 pointsby redxbloodover 8 years ago
Simple question: Suppose i&#x27;m going to use bootstrap, and I have to include it in my project.<p>It doesn&#x27;t make any difference to me whether to use a cdn or npm.<p>Which should I use in your opinion?

1 comment

niftichover 8 years ago
CDN. There&#x27;s a higher likelihood that a user of your site would have it cached, considering how popular Bootstrap is, and if it doesn&#x27;t bother you that you&#x27;re serving traffic through and directing users to a third-party.<p>Consider using Subresource Integrity [1][2] to pin a particular checksum to the particular version served from the CDN, for some extra assurance that the CDN is delivering correct file. This, of course, only works if you link to a static file that&#x27;s unlikely to change, and not, say, &#x27;bootstrap-latest.css&#x27;.<p>[1] <a href="https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2016&#x2F;REC-SRI-20160623&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2016&#x2F;REC-SRI-20160623&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2016&#x2F;REC-SRI-20160623&#x2F;#use-casesexamples" rel="nofollow">https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2016&#x2F;REC-SRI-20160623&#x2F;#use-casesexampl...</a>