This repository was archived by the owner on May 12, 2025. It is now read-only.
generated fromTommasoAmici/typescript-template
- Notifications
You must be signed in to change notification settings - Fork0
TommasoAmici/html-webpack-plugin-django
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A template for Typescript projects
First, install the package
# npm install -D html-webpack-plugin-djangoyarn add -D html-webpack-plugin-django
In yourwebpack.config.js
file add the plugin afterhtml-webpack-plugin
.html-webpack-plugin-django
will output Django static tags in the head and body of your HTML index file.
This plugin operates under a few assumptions:
- You have added the
{% load static %}
tag to your HTML template - Your webpack bundle is emitted in one of yourDjango project's static files directories.
Example
constpath=require("path");constHtmlWebpackPlugin=require("html-webpack-plugin");constHtmlWebpackPluginDjango=require("html-webpack-plugin-django");module.exports=(env,argv)=>{return{output:{path:path.resolve("path/to/your/django/static/dist"),filename:"js/[name].[contenthash].js",publicPath:"/static/",}, ...plugins:[newHtmlWebpackPlugin(),newHtmlWebpackPluginDjango({bundlePath:"dist"}),],};};
Output
<scriptdefersrc="{% static 'dist/js/runtime.1198543abbf33da21374.js' %}"></script>
Please file a report inthis repository's issues
If you want to contribute to this project, that's great to hear!
You can start atCONTRIBUTING.md.
About
A Webpack plugin to output Django static tags with html-webpack-plugin
Topics
Resources
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.