Flask+Vite integration.
Project description
Flask-Vite
Plugin to simplify use of Vite from Flask.
- Status: Bêta.
- Free software: MIT license
Usage
Instantiate the Flask extension as you do for other Flask extensions:
from flask_vite import Vite
app = Flask(...)
vite = Vite(app)
# or
vite = Vite()
vite.init_app(app)
Then you can use the following commands:
$ flask vite
Usage: flask vite [OPTIONS] COMMAND [ARGS]...
Perform Vite operations.
Options:
--help Show this message and exit.
Commands:
build Build the Vite assets.
check-updates Check outdated Vite dependencies.
init Init the vite/ directory (if it doesn't exist)
install Install the dependencies using npm.
start Start watching source changes for dev.
update Update Vite and its dependencies, if needed.
Features
- Manages a
vite
directory where you put your front-end source code. - Auto-injects vite-generated assets into your HTML pages (if
VITE_AUTO_INSERT
is set in the Flask config). - Use
{{ vite_tags() }}
in your Jinja templates otherwise.
Configuration
The following (Flask) configuration variables are available:
VITE_AUTO_INSERT
: if set, the extension will auto-insert the Vite assets into your HTML pages.NPM_BIN_PATH
: path to thenpm
binary. Defaults tonpm
.
Demo
See the demo/
directory for a working demo using TailwindCSS.
Credits
This project is inspired by the Django-Tailwind project.
This package was created with Cookiecutter, using the abilian/cookiecutter-abilian-python project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask_vite-0.3.2.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for flask_vite-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa1d3aed5e84c8b70934e05f9912f0f3c89313d4d10c15762381668ad63ab09a |
|
MD5 | cdae9733387139f5e5869acb2074c1be |
|
BLAKE2b-256 | 13ec3f567f872d21e194b8638fae5b9209a0b95a669a1e97e6b0da748a3a04d7 |