Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 12, 2025. It is now read-only.

A Webpack plugin to output Django static tags with html-webpack-plugin

NotificationsYou must be signed in to change notification settings

TommasoAmici/html-webpack-plugin-django

Repository files navigation

A template for Typescript projects

At a glance

Node.js CIcodecov

Getting started

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:

  1. You have added the{% load static %} tag to your HTML template
  2. 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>

Found a bug?

Please file a report inthis repository's issues

Development

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

Stars

Watchers

Forks

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp