bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Best way to extend Bootstrap for custom app

Open netatoo opened this issue 14 years ago • 7 comments

Hi all,

I discovered Bootstrap a few months ago and I would like to thank all contributors!

During my first install of Bootstrap, I directly edited the *.less you give, I just think it's not a good practice, after experience.

Indeed, when moving to the new fresh release, it's very tedious to compare each file to see what changes are to be transferred to the new code.

So I created a "custom" folder into /less, in which I found only my custom code, i do not change the code provided by Bootstrap, except variables.less and responsive.less.

- less
     - custom
         - bootstrap.less
         - buttons.less
         - my.plugin.less
         - Etc. ...

So I can update, almost daily, the source code via git, simply make file diff on variables.less and responsive.less to pass the changes.

Is this a good practice? How do you work for your personal/professionals projects based on Bootstrap?

Regards, Simon

PS : sorry for my poor English ^^

netatoo avatar Mar 16 '12 22:03 netatoo

Interesting discussion. Like to hear what others think too. I actually have:

app.less
   --import my_own_bootstrap_vars.less
   --import bootstrap/all_other_bootstrap_modules_except_vars.less
   --import my_own_overrides_gridlayoutthings.less
   --import my_own_overrides_adds_typical_modules.less

Yeah good idea to mod your own responsive.less. I have my troubles as well since its still very limited and blocked certain things. (like try working a way to let the nav bar only collapse at phone-width using the nav-collapse class or custom coloring the popup menu in regards to the collapse menu at small displays)

I also tried including the compiled default full css bootstrap file and then manually overwriting everything, But that's just stupid.. A lot of extra work, sometimes not even easy possible and writing my own mixin again.. So I wouldn't advice anyone that route.

Like always it's a bit of an experiment and if you end up that by using bootstrap you have to manually overwrite almost everything, you're better off just picking the source, code/mod your way up and just settle with the bugs and errors and try solving them manually in the future I think. With many frameworks, they grow and grow and grow... get bloated.. have backwards compatibility, and docs get outdated.

I rather have a framework that is super stable and consequent and small and maintainable where i can ADD things I (ie. a text shadow on the labels) than having to overwrite all kind of things and ie. REMOVE something. Just doesn't feel right.. time will tell. A bit like the reset.css vs normalize.css discussion.. Just hope the maintainers keep their strong vision/architecture since its so beautiful now.

sannefoltz avatar Mar 16 '12 23:03 sannefoltz

Yeah it's always good to discuss and know how others do it!

I use CodeKit to compile the LESS files (and javascript) so it's pretty simple to build on the source to add its own features, add some fix according to the desired interface.

To add a shadow on the labels, I simply create a file named /custom/labels.less where I just put this code:

.label {
     .box-shadow(...);
}

If I understood correctly we are doing almost exactly the same with perhaps a different file organization ?

Now i've a stable css core for my apps, maintained by community (and me if i can help): Bootstrap Twitter, where I can monitor developments & fixes on my favorite git client (GitBox right now), and add my code on /custom by simply override with the same file names. The organization is more pleasant to maintain, assuming that we keep the outline of the Bootstrap without starting from scratch.

netatoo avatar Mar 17 '12 03:03 netatoo

There's already a related discussion: Docs feature: how to extends Bootstrap

mneuhaus avatar Mar 18 '12 22:03 mneuhaus

Kickstrap

adamjgrant avatar Mar 22 '12 19:03 adamjgrant

Yep I found your fork a few days ago, very useful and handy to have assembled Bootstrap and the best of h5bp, really cool!

netatoo avatar Mar 22 '12 20:03 netatoo

And you're right about the overriding. That was my initial work on this project. Let me know if you have any requests for it.

adamjgrant avatar Mar 22 '12 21:03 adamjgrant

Closing as dupe of #1451.

mdo avatar Mar 23 '12 06:03 mdo