Bootstrap-sass Gem vs CDN

Various Ruby on Rails tutorials have been instrumental in introducing bootstrap sass pearls. Why is this agreement not a CDN?

I included in the title of my application:

<!-- BOOTSTRAP CSS 3.3.5 CDN: --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> 

And in the footer:

  <!-- BOOTSTRAP JS 3.3.5 CDN --><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" type="text/javascript"></script> 

Assuming I always work from a development box that is connected to the Internet: What is the reason for using self-tuning pearls instead of just pointing to a CDN? Isn't it always faster to point to a CDN where the client may already have a cached file?

+8
css ruby-on-rails twitter-bootstrap cdn
source share
2 answers

The likely reason that Rails tutorials suggest that the bootstrap-sass is just a matter of convenience; As Rails developers, we are used to adding a line to our Gemfile to integrate third-party libraries.

Additional advantages for the gem: after you complete the bundle install , you will not need an Internet connection to download development resources (there is no need to connect to an external CDN). Alternatively, you can use SASS to override Mixstart variables and customize the framework.

These advantages aside, if you do not configure Bootstrap, there is no need to use boostrap-sass in production. In fact, your argument about clients, perhaps already having CDN versions for publicly available JS / CSS frameworks, is certainly valid.

Short answer: don't think of the boostrap-sass as consent. This is a good starting point for configuration, but if configuration is not required, it is wise to go with a CDN.

+10
source share

Using CDN just gives you CSS, tightly linking your HTML files to a specific version of the bootstrap. Using the bootstrap version of SASS / LESS allows you to put semantic classes in your HTML and establish a link between your semantic classes and Bootstrap in your specific SASS / LESS files of your application (using @import , @extend ...)

If you use this technique wisely, you will find yourself in smaller sizes, since you only import the parts of the boot buffer that you actually use in your application, and you will have a clear separation of problems, which will allow you to switch between less / no more assorted touching HTML files (ideally).

-one
source share

All Articles