Skip to main content

Flask+Vite integration.

Reason this release was yanked:

buggy

Project description

Flask-Vite

image

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 the npm binary. Defaults to npm.

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


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.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_vite-0.3.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file flask_vite-0.3.1.tar.gz.

File metadata

  • Download URL: flask_vite-0.3.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for flask_vite-0.3.1.tar.gz
Algorithm Hash digest
SHA256 343f22783207a0062698321438af91b21c87ba429353761ea68922b2155ce9ca
MD5 15b655668d2f1484698bb47cf031960e
BLAKE2b-256 7db40a2cb81d81edc1365bd9041a5dfe7e64e963bd44ad444f3cfca1f6c857d3

See more details on using hashes here.

File details

Details for the file flask_vite-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: flask_vite-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for flask_vite-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2c5435b86e095adb90b579263b402e61b2cbcd3e481c5b8fe54f9594d2b8c5b
MD5 603d916a3f72252714fc2b693852bfdd
BLAKE2b-256 c994c924b181e5cb6b4656332089b14fc1279a40bae618a70c194fc39692616b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page