bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Python wrapper package for precompiled Bootstrap assets

Open MaximilianClemens opened this issue 9 months ago • 1 comments

Description

A trivial change to make the precompiled CSS and JS files available for Python projects.

Motivation & Context

The motivation behind this change is to avoid having to manually update the assets (CSS + JS) in my FastAPI application. By integrating these assets as a dependency, users will always have access to the latest version automatically.

Type of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Refactoring (non-breaking change)
  • [ ] Breaking change (fix or feature that would change existing functionality)

Checklist

  • [x] I have read the contributing guidelines
  • [x] My code follows the code style of the project (using npm run lint)
  • [x] My change introduces changes to the documentation
  • [x] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] All new and existing tests passed

Live previews

pip install git+https://github.com/MaximilianClemens/bootstrap.git
( pip install git+https://github.com/twbs/bootstrap.git ) # when accepted
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from pathlib import Path
import importlib.metadata

app = FastAPI()

# Retrieve the distribution information for the 'bootstrap' package.
dist = importlib.metadata.distribution("bootstrap")

# Locate the static assets installed as package data.
static_path = Path(dist.locate_file("bootstrap/dist"))

app.mount("/bootstrap", StaticFiles(directory=str(static_path)), name="bootstrap")

Related issues

MaximilianClemens avatar Mar 12 '25 22:03 MaximilianClemens

A trivial change to make the precompiled CSS and JS files available for Python projects.

Trivial perhaps, but adding it here means we're maintaining it. I'm not so sure about adding this to our project at this point. Could this be a separate repo and dependency that consumes the upstream project? I'd be happy to see that in the @twbs org.

mdo avatar Apr 06 '25 20:04 mdo

Closing as a won't fix/implement—thanks though!

mdo avatar Jun 03 '25 21:06 mdo