Boostrap4: Which way?

I would like to use boostrap4.

I see these ways:

  1. I use the CDN. Pro: My git repo stays small. Con: development needs internet access

  2. copy bootstrap into the git repo of my app. Con: github repo size increased

  3. copy boostrap into the git repo of my project. Con: github repo size increased

  4. Use django-boostrap4 pypi project
    Pro: My git repo stays small. And internet access during daily development not needed.

  5. AFAIK a python package can only depend on a package hosted at a pypi server. But maybe there is even a cool way to depend on boostrap in npm somehow.

  6. Create an install-script which downloads boostrap once during installing. This has the benefit that my git repo stays clean and during daily development no internet access is required.

  7. I am sure there is a seventh or 8th ways to solve this.

What do you suggest?

One of the features of git is that if you’re not making changes to the code, subsequent commits don’t increase the size of the repository. (It’s not copying unchanged files each time.

Since I would assume that you’re not making regular updates to bootstrap, then the increase in repo size is one-time only - and in real terms, it’s negligible.

As a side note, we include all of those types of resources in our repos. We have a directory structure that includes bootstrap, jquery, and datatables. So you can say we’re definitely in the “Option 3” camp. (These resources are project-wide, not app wide, so they belong at the project level.)

There may well be other options, but we haven’t ever identified any that are as simple and low overhead as #3. (We even have a couple projects where we include the python wheels for the virtual environment in the repo to have a completely self-contained deployment for systems that don’t have internet access.)

Ken

2 Likes

Thank you for your reply. I think I go your way.

Nevertheless it would be very cool if pip could download packages from npm. This way I could say “require bootstrap4” and pip download and installs it in my virtualenv. Would be very nice.

Personally, I like to include Bootstrap files in my repo. I rarely serve it from a CDN.

That way, if I wish to theme Bootstrap in some way, I can use one of the many Bootstrap theme generators out there and just swap out the CSS to get better colours / remove border radiuses etc.

1 Like