Use webpack with your multi-page, multilingual django webapp
Project description
django-webpack-pages
Use webpack with your multi-page, multilingual django webapp.
Put the following in your settings file:
WEBPACK_PAGES = {
"CRITICAL_CSS_ENABLED": True,
"ROOT_PAGE_DIR": osp.join(BASE_DIR, "pages"),
"STATICFILE_BUNDLES_BASE": "bundles/{locale}/", # should end in /
}
Using webpack_loader.contrib.pages
you can register entrypoints for corresponding pages in templates.
At the top of your individual page, do:
{% extends "layout.jinja" %}
{% do register_entrypoint("myapp/dashboard") %}
In the layout's (base template's) head, place the following:
<!DOCTYPE html>
{% do register_entrypoint("main") %}
<html lang="{{ LANGUAGE_CODE }}">
<head>
...
{{ render_css() }}
</head>
<body>
...
{{ render_js() }}
</body>
This will load the registered entrypoints in order (main
, then myapp/dashboard
) and automatically inject
the webpack-generated css and js. It also supports critical css injection upon first request visits.
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
Built Distribution
Close
Hashes for django-webpack-pages-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0539b719c38e924051f03990508e1d6c7b586e02811dec39d5f14a63b4928ea |
|
MD5 | 94ac22c758dddd6e073576b49d6439b8 |
|
BLAKE2b-256 | 56ddf3caeaa68e5bd0ab01171709dd7efa0565ffefe725680d97a035397f8813 |
Close
Hashes for django_webpack_pages-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e5440bbda115255fdebe77ee1467f1a2313df4ecac4e6fb3fbd9035d7fa6c08 |
|
MD5 | 15f5ebe0bb17cdf26533d107c0cb970e |
|
BLAKE2b-256 | 717f9fc175cf312f5451a9c44450666b53c9f61e27bc02ac5fed7ba209484823 |