Installations
npm install mix-gulp-hash-src
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
6.6.0
NPM Version
3.10.7
Score
69.3
Supply Chain
97.7
Quality
75.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
DestinyXie
Download Statistics
Total Downloads
3,424
Last Day
1
Last Week
1
Last Month
7
Last Year
366
GitHub Statistics
6 Commits
1 Watching
1 Branches
1 Contributors
Bundle Size
39.80 kB
Minified
10.69 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.1.6
Package Id
mix-gulp-hash-src@0.1.6
Size
3.49 kB
NPM Version
3.10.7
Node Version
6.6.0
Total Downloads
Cumulative downloads
Total Downloads
3,424
Last day
0%
1
Compared to previous day
Last week
-50%
1
Compared to previous week
Last month
16.7%
7
Compared to previous month
Last year
58.4%
366
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
mix-gulp-hash-src
Automatically add cache busting hashes to links in HTML and CSS, copyright mix corp. inherit form gulp-hash-src
Usage
1var gulp = require("gulp"), 2 hash_src = require("gulp-hash-src"); 3 4gulp.task("hash", function() { 5 return gulp.src(["./client/**/*.html", "./client/**/*.css"]) 6 .pipe(hash_src({build_dir: "./build", src_path: "./client"})) 7 .pipe(gulp.dest("./build")) 8});
Or added it to the pipe line:
1var gulp = require("gulp"), 2 htmlmin = require("gulp-htmlmin"), 3 hash_src = require("gulp-hash-src"); 4 5gulp.task("html", ["js", "css"], function () 6{ 7 return gulp.src("./client/**/*.html") 8 .pipe(htmlmin()) 9 .pipe(hash_src({build_dir: "./build", src_path: "./client"})) 10 .pipe(gulp.dest("./build")) 11});
That will turn something like
1<script src="file.js">
into
1<script src="file.js?cbh=0123456789abcdef">
or
1html { 2 background: url(image.jpg); 3}
into
1html { 2 background: url(image.jpg?cbh=0123456789abcdef); 3}
Note
The files that are to be hash must be located in build_dir
prior to running hash_src()
.
Options
build_dir Where the files are that need to be hashed (required)
src_path Where the files originated from (required)
hash The type of hash (default: "md5")
hash_len The length of the hash (default: null)
If hash_len is falsey, the entire hash is used.
enc Hash encoding (default: "hex")
exts An array of the types of files to hash
(default: [".js", ".css", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".pdf", ".ico", ".ttf", ".woff", ".mp3", ".ogg", ".ogv", ".mp4", ".webm", ".zip", ".tar", ".gz", ".bz2"])
regex The regular expression to find links
(by default it looks for something like src="..." href="..." url(...)
analyze The function to use to analyze the regular expression matches
The function will receive an array of the matches from the regex.
Must return an object like so:
{
prefix: "href=",
link: "/file.js",
suffix: "",
abs: false (optional)
}
query_name The query string to add to the hash (default: "cbh")
Turns links into href="file.css?cbh=0123456789abcdef"
To remove the string entirely, give a blank string and get
href="file.css?0123456789abcdef"
verbose Whether or not to log info about what is happening (default: false)
Useful for debugging
cdn_prefix And cdn prefix url
cdn_prefix_except_ext An array of the types of files no need to add cdn_prefix, example: ['.css']
License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/6 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 SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2024-12-23
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