Reputation: 1531
I would like to keep my customized bootstrap stylesheet up to date with the latest version whenever a new version is released.
I would like to be able to easily update from for instance bootstrap version 3.2.0 to bootstrap version 3.3.4 and then from there on to any future version as well (keeping in mind that bootstrap does not completely change structure).
Is there any easy way that this can be achieved?
Or
Is there a specific way I can structure my stylesheet to make it easier to update to newer versions?
I would like to be able to keep up with the latest versions without having to redo most of my custom style changes.
Upvotes: 2
Views: 1226
Reputation: 1061
Leave the original bootstrap files alone and override/extend the style in your own css files. That way you will be able to update bootstrap without any problems.
Just make sure your custom style precedence is higher than from bootstrap provided classes. Something like:
your html:
<div id="my-website">
<button class="btn btn-default" type="submit">Button</button>
</div>
your css:
#my-website .btn {
display: inline-block;
width: 100px;
height: 100px;
}
this way you will override default bootstrap .btn class functionality with your own without modifying bootstrap itself and since the button is inside a div with an id, you will have higher precedence by specifying that relationship than bootstrap styles and your style modifications will be applied.
Forking their GitHub repo https://github.com/twbs/bootstrap and making changes in your fork. That way whenever you want to update your bootstrap version all you have to do is sync your repo with the upstream and merge your changes with theirs.
While this will add more complexity, it will definitely allow you to modify the original bootstrap files without robbing you of the ability to update without too much hassle.
P.S.: I'd recommend using a separate branch for your own stuff so that if you ever wanted to contribute to bootstrap, you could use the same fork and wouldn't need to do any magic to clean up your master branch. Not to mention that updating the repo would be simpler that way, just pull rebase the master branch from upstream into your repos master and then merge the master branch into your own branch.
Upvotes: 2
Reputation: 666
you can do, as it says Hashem Qolami and whether to keep their own styles, of course you can do! by its own "theme.css" What I do and what I run every time you leave something new startup if the proper makeup and call updagrate within my server, but do not cdn not depend on anyone .
you have to do is bootstrap CDN to keep the latest version (not recommended)
http://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css
http://maxcdn.bootstrapcdn.com/bootstrap/latest/js/bootstrap.min.js
and maintain your own theme.css
<head>
<link rel="stylesheet" href="asset/css/theme.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
<script type="text/javascript" src="asset/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/latest/js/bootstrap.min.js"></script>
</head>
Upvotes: 1