Gathering detailed insights and metrics for posthtml-img-src-rewrite
Gathering detailed insights and metrics for posthtml-img-src-rewrite
Gathering detailed insights and metrics for posthtml-img-src-rewrite
Gathering detailed insights and metrics for posthtml-img-src-rewrite
npm install posthtml-img-src-rewrite
Typescript
Module System
Min. Node Version
Node Version
NPM Version
68
Supply Chain
98.1
Quality
75.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
560
Last Day
1
Last Week
7
Last Month
16
Last Year
80
6 Commits
3 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.3.0
Package Id
posthtml-img-src-rewrite@0.3.0
Unpacked Size
12.38 kB
Size
5.16 kB
File Count
23
NPM Version
7.5.2
Node Version
15.7.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
7
Compared to previous week
Last month
1,500%
16
Compared to previous month
Last year
-15.8%
80
Compared to previous year
Rewrite an img src according to prefix/suffix rules
Before:
1<html> 2 <body> 3 <img src="images/test.png"> 4 </body> 5</html>
After:
1<html> 2 <body> 3 <img src="images/prefix_test_suffix.png"> 4 </body> 5</html>
1npm i posthtml-img-src-rewrite
Pass in options for the prefix
and suffix
values to be used for the <img src>
rewrites.
1const fs = require('fs'); 2const posthtml = require('posthtml'); 3const imgSrcRewrite = require('posthtml-img-src-rewrite'); 4 5posthtml() 6 .use(imgSrcRewrite({ prefix: 'prefix_', suffix: '_suffix' })) 7 .process(html/*, options */) 8 .then(result => fs.writeFileSync('./after.html', result.html));
Pass in the values to be used as the prefix
and suffix
of all <img src>
rewrites.
Options allow the use of functions to calculate the values as well.
Before:
1<html> 2 <body> 3 <img src="images/test.png"> 4 </body> 5</html>
Add option:
1const fs = require('fs'); 2const posthtml = require('posthtml'); 3const imgSrcRewrite = require('posthtml-img-src-rewrite'); 4 5posthtml() 6 .use(imgSrcRewrite({ prefix: () => 'prefix_', suffix: () => '_suffix' })) 7 .process(html/*, options */) 8 .then(result => fs.writeFileSync('./after.html', result.html));
After:
1<html> 2 <body> 3 <img src="images/prefix_test_suffix.png"> 4 </body> 5</html>
Exclude images from rewrite based on class. By default, this class is img-src-rewrite-exclude
.
Before:
1<html> 2 <body> 3 <img src="images/test.png"> 4 <img src="images/exclude.png" class="img-src-rewrite-exclude"> 5 </body> 6</html>
Add option:
1const fs = require('fs'); 2const posthtml = require('posthtml'); 3const imgSrcRewrite = require('posthtml-img-src-rewrite'); 4 5posthtml() 6 .use(imgSrcRewrite({ prefix: () => 'prefix_', suffix: () => '_suffix', excludeClass: 'img-src-rewrite-exclude' })) 7 .process(html/*, options */) 8 .then(result => fs.writeFileSync('./after.html', result.html));
After:
1<html> 2 <body> 3 <img src="images/prefix_test_suffix.png"> 4 </body> 5</html>
See PostHTML Guidelines and contribution guide.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
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
Reason
detected GitHub workflow tokens with excessive permissions
Details
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
branch protection not enabled on development/release branches
Details
Reason
45 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
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