Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-webpack-injector

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-webpack-injector - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

16

index.js

@@ -32,5 +32,5 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");

if (typeof asyncNames === "object" && typeof deferNames === "object") {
if(typeof asyncNames === "object" && asyncNames?.length){
tags.forEach(tag => {
// add async/defer only on script tags.
// add async only on script tags.
if (!tag.attributes.href && tag.attributes.src) {

@@ -40,2 +40,10 @@ asyncNames.forEach(name => {

});
}
});
}
if(typeof deferNames === "object" && deferNames?.length){
tags.forEach(tag => {
// add defer only on script tags.
if (!tag.attributes.href && tag.attributes.src) {
deferNames.forEach(name => {

@@ -46,6 +54,2 @@ addAttributesToTag(tag, name, {defer: true});

});
} else {
console.log("-------------------------------------");
console.error("Invalid value given to chunksConfig option");
console.log("-------------------------------------");
}

@@ -52,0 +56,0 @@ }

{
"name": "html-webpack-injector",
"version": "1.1.2",
"version": "1.1.3",
"description": "Helps to inject chunks to head and body via HtmlWebpackPlugin with additional options to add async/defer to chunks",

@@ -17,5 +17,5 @@ "main": "index.js",

],
"repository": "https://github.com/thearchitgarg/html-webpack-injector.git",
"author": "Archit garg <thearchitgargg@gmail.com> (https://github.com/thearchitgarg)",
"repository": "https://github.com/architgarg/html-webpack-injector.git",
"author": "Archit garg <thearchitgargg@gmail.com> (https://github.com/architgarg)",
"license": "ISC"
}

@@ -1,7 +0,7 @@

<div align="center">
<h1>HTML Webpack Injector Plugin</h1>
<p>Plugin that simplifies injection of chunks into <b>head</b> and <b>body</b> using <a href="https://github.com/jantimon/html-webpack-plugin">HtmlWebpackPlugin</a></p>
<div>
<h1 align="center">HTML Webpack Injector Plugin</h1>
<p>Plugin that simplifies injection of chunks into <b>head</b> and <b>body</b> using <a href="https://github.com/jantimon/html-webpack-plugin">HtmlWebpackPlugin</a> (with ability to provide async/defer)</p>
</div>
<h2 align="center">Installation</h2>
<h2>Installation</h2>

@@ -20,3 +20,3 @@ ```bash

<h2 align="center">Usage</h2>
<h2>Usage</h2>
Suppose you want have `2 chunks` that you want to inject in the html document using HtmlWebpackPlugin. If you want to inject `one chunk in head` and `one chunk in body` of the same html document.

@@ -44,3 +44,3 @@

}),
new HtmlWebpackInjector()
new HtmlWebpackInjector() // Initialize plugin
]

@@ -69,3 +69,3 @@ }

<h2 align="center">Provide Async Defer (Optional)</h2>
<h2>Provide Async Defer (Optional)</h2>
You can specify scripts to be async or defer by adding additional `chunksConfig` option.

@@ -84,4 +84,4 @@

}),
new HtmlWebpackInjector()
new HtmlWebpackInjector()
]
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc