Gathering detailed insights and metrics for @principalstudio/html-webpack-inject-preload
Gathering detailed insights and metrics for @principalstudio/html-webpack-inject-preload
Gathering detailed insights and metrics for @principalstudio/html-webpack-inject-preload
Gathering detailed insights and metrics for @principalstudio/html-webpack-inject-preload
npm install @principalstudio/html-webpack-inject-preload
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
31 Stars
38 Commits
4 Forks
4 Watching
1 Branches
3 Contributors
Updated on 05 Oct 2024
Minified
Minified + Gzipped
TypeScript (81.42%)
HTML (11.57%)
CSS (4%)
JavaScript (3.02%)
Cumulative downloads
Total Downloads
Last day
-10.1%
2,515
Compared to previous day
Last week
-3.4%
13,090
Compared to previous week
Last month
-14.1%
63,692
Compared to previous month
Last year
67.7%
712,288
Compared to previous year
A HTML Webpack Plugin for injecting <link rel='preload'>
This plugin allows to add preload links anywhere you want.
You need to have HTMLWebpackPlugin v4 or v5 to make this plugin work.
npm i -D @principalstudio/html-webpack-inject-preload
webpack.config.js
1const HtmlWebpackPlugin = require('html-webpack-plugin'); 2const HtmlWebpackInjectPreload = require('@principalstudio/html-webpack-inject-preload'); 3 4module.exports = { 5 entry: 'index.js', 6 output: { 7 path: __dirname + '/dist', 8 filename: 'index_bundle.js' 9 }, 10 plugins: [ 11 new HtmlWebpackPlugin(), 12 new HtmlWebpackInjectPreload({ 13 files: [ 14 { 15 match: /.*\.woff2$/, 16 attributes: {as: 'font', type: 'font/woff2', crossorigin: true }, 17 }, 18 { 19 match: /vendors\.[a-z-0-9]*.css$/, 20 attributes: {as: 'style' }, 21 }, 22 ] 23 }) 24 ] 25}
Options
rel="preload"
by default.Usage
The plugin is really simple to use. The plugin injects in headTags
, before any link, the preload elements.
For example
1<!DOCTYPE html> 2<html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Webpack App</title> 6 <%= htmlWebpackPlugin.tags.headTags %> 7 </head> 8 <body> 9 <script src="index_bundle.js"></script> 10 </body> 11</html>
will generate
1<!DOCTYPE html> 2<html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Webpack App</title> 6 <link href="dist/fonts/font.woff2" rel="preload" type="font/woff2" crossorigin> 7 <link href="dist/css/main.css"> 8 </head> 9 <body> 10 <script src="index_bundle.js"></script> 11 </body> 12</html>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/16 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More