Gathering detailed insights and metrics for bs-html-injector
Gathering detailed insights and metrics for bs-html-injector
Gathering detailed insights and metrics for bs-html-injector
Gathering detailed insights and metrics for bs-html-injector
npm install bs-html-injector
Typescript
Module System
Node Version
NPM Version
73.8
Supply Chain
90.5
Quality
70.2
Maintenance
25
Vulnerability
97
License
JavaScript (97.96%)
HTML (2.04%)
Total Downloads
2,677,461
Last Day
55
Last Week
2,213
Last Month
11,992
Last Year
208,515
77 Stars
81 Commits
21 Forks
7 Watchers
4 Branches
6 Contributors
Updated on Jun 01, 2025
Minified
Minified + Gzipped
Latest Version
3.0.3
Package Id
bs-html-injector@3.0.3
Size
32.05 kB
NPM Version
2.15.5
Node Version
4.4.5
Cumulative downloads
Total Downloads
Last Day
-91.4%
55
Compared to previous day
Last Week
-35.7%
2,213
Compared to previous week
Last Month
-12.2%
11,992
Compared to previous month
Last Year
-67.8%
208,515
Compared to previous year
4
6
Browsersync plugin for injecting HTML changes without reloading the browser. Requires an existing page with a <body>
tag.
1$ npm i browser-sync bs-html-injector
1$ npm i browser-sync bs-html-injector@2
##Options
files - String|Array File watching patterns that will trigger the injection. NOTE: Ensure you are not also watching the same file through the regular Browsersync config - this will cause a full reload and the inject will not happen
1browserSync.use(require("bs-html-injector"), { 2 files: ["app/*.html", "app/templates/**"] 3});
restrictions - Array Limit the comparisons to a certain elements.
1browserSync.use(require("bs-html-injector"), { 2 files: "app/*.html", 3 restrictions: ['#header', '#footer'] 4});
excludedTags - Array
When working from scratch within the body
tag, the plugin will work just fine. But when you start
working with nested elements, you might want to add the following configuration to improve the
injecting.
1browserSync.use(require("bs-html-injector"), { 2 files: "app/*.html", 3 excludedTags: ["BODY"] 4});
###Example
Create a file called bs.js
and enter the following: (update the paths to match yours)
1// requires version 2.0 of Browsersync or higher. 2var browserSync = require("browser-sync").create(); 3var htmlInjector = require("bs-html-injector"); 4 5// register the plugin 6browserSync.use(htmlInjector, { 7 // Files to watch that will trigger the injection 8 files: "app/*.html" 9}); 10 11// now run Browsersync, watching CSS files as normal 12browserSync.init({ 13 files: "app/styles/*.css" 14});
###Gulp example
1var gulp = require("gulp"); 2var browserSync = require("browser-sync").create(); 3var htmlInjector = require("bs-html-injector"); 4 5/** 6 * Start Browsersync 7 */ 8gulp.task("browser-sync", function () { 9 browserSync.use(htmlInjector, { 10 files: "app/*.html" 11 }); 12 browserSync.init({ 13 server: "test/fixtures" 14 }); 15}); 16 17/** 18 * Default task 19 */ 20gulp.task("default", ["browser-sync"], function () { 21 gulp.watch("test/fixtures/*.html", htmlInjector); 22});
1// This shows a full config file!
2module.exports = function (grunt) {
3 grunt.initConfig({
4 watch: {
5 files: 'app/scss/**/*.scss',
6 tasks: ['bsReload:css']
7 },
8 sass: {
9 dev: {
10 files: {
11 'app/css/main.css': 'app/scss/main.scss'
12 }
13 }
14 },
15 browserSync: {
16 dev: {
17 options: {
18 watchTask: true,
19 server: './app',
20 plugins: [
21 {
22 module: "bs-html-injector",
23 options: {
24 files: "./app/*.html"
25 }
26 }
27 ]
28 }
29 }
30 },
31 bsReload: {
32 css: "main.css"
33 }
34 });
35
36 // load npm tasks
37 grunt.loadNpmTasks('grunt-contrib-sass');
38 grunt.loadNpmTasks('grunt-contrib-watch');
39 grunt.loadNpmTasks('grunt-browser-sync');
40
41 // define default task
42 grunt.registerTask('default', ['browserSync', 'watch']);
43};
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 3/27 approved changesets -- score normalized to 1
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
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
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