Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Am I supposed to copy bootstrap folder to each new project?

This may be a stupid question, but I've downloaded Bootstrap 3 to make a new website.

Am I supposed to / Is the best practice to copy the entire Bootstrap folder into my New Website folder? And then this would be the easiest way to upload the server eventually? And do this for every new project?

Or am I supposed to just leave one copy in the Bootstrap 3 folder and reference it with my code?

I looked everywhere for this and can't seem to find a good answer, maybe this is just obvious to everyone. Thanks for any help!

like image 919
Phil Avatar asked Mar 14 '23 18:03

Phil


1 Answers

You can very well use the CDN (Content Delivery Network) to serve the Bootstrap files.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

Including the above will eliminate your issue to add the bootstrap files to every folder. Moreover, you are not supposed to add it in every folder. Say if you have a site as http://example.com/, you need to create two directories, namely js and css and add the files there, and link this way throughout the site structure:

<link href="/css/bootstrap.min.css" rel="stylesheet" />
<script src="/js/bootstrap.min.js"></script>

Notice the / at the starting of the URL, which says this is a relative to domain URL. You need to use the above HTML to add the bootstrap content to all the pages, if you are using a template (that has headers and loads it on all the pages).

like image 132
Praveen Kumar Purushothaman Avatar answered Mar 17 '23 19:03

Praveen Kumar Purushothaman