Installations
npm install posthtml-load-options
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4
Node Version
7.1.0
NPM Version
3.10.9
Score
70.4
Supply Chain
98.9
Quality
79.1
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (78.46%)
HTML (18.78%)
Standard ML (2.77%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
posthtml
Download Statistics
Total Downloads
905,036
Last Day
352
Last Week
1,860
Last Month
9,039
Last Year
130,426
GitHub Statistics
1 Stars
20 Commits
4 Watching
1 Branches
10 Contributors
Package Meta Information
Latest Version
1.0.0
Package Id
posthtml-load-options@1.0.0
Size
6.27 kB
NPM Version
3.10.9
Node Version
7.1.0
Total Downloads
Cumulative downloads
Total Downloads
905,036
Last day
-26.7%
352
Compared to previous day
Last week
-21.7%
1,860
Compared to previous week
Last month
-4%
9,039
Compared to previous month
Last year
-4%
130,426
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Load Options
Autoload Options for PostHTML
Install
1npm i -D posthtml-load-options
Usage
package.json
Create a posthtml
section in package.json
.
Root
|– client
|– public
|
|- package.json
1{ 2 "dependencies": { 3 "posthtml-sugarml": "^1.0.0" 4 }, 5 "posthtml": { 6 "parser": "posthtml-sugarss", 7 "from": "path/to/src/file.html", 8 "to": "path/to/dest/file.html" 9 } 10}
.posthtmlrc
Create a .posthtmlrc
file.
Root
|– client
|– public
|
|-.posthtmlrc
|- package.json
1{ 2 "parser": "posthtml-sugarss", 3 "from": "path/to/src/file.html", 4 "to": "path/to/dest/file.html" 5}
posthtml.config.js
Create a posthtml.config.js
file.
Root
|– client
|– public
|
|- posthtml.config.js
|- package.json
1module.exports = (ctx) => { 2 return { 3 parser: ctx.ext ==='.sml' ? 'posthtml-sugarss' : false, 4 from: 'path/to/src/file.html', 5 to: 'path/to/dest/file.html' 6 } 7}
Options
parser
:
1parser: 'posthtml-sugarss'
from
:
1from: 'path/to/dest/file.html'
to
:
1to: 'path/to/dest/file.html'
render
:
1render: 'posthtml-jsx'
Context
When using a function in (posthtml.config.js)
, it's possible to pass context to posthtml-load-options
, which will be evaluated before loading your options. By default ctx.env (process.env.NODE_ENV)
and ctx.cwd (process.cwd())
are available.
Example
posthtml.config.js
1export default config = (ctx) => { 2 return { 3 parser: ctx.ext === '.sml' ? 'posthtml-sugarml' : false, 4 from: 'client/index.html', 5 to: 'public/index.html' 6 } 7}
1import { dirname } from 'path' 2import { readFileSync } from 'fs' 3 4import posthtml from 'posthtml' 5import optionsrc from 'posthtml-load-options' 6 7const sml = readFileSync('./client/index.sml', 'utf8') 8 9const ctx = { ext: dirname(sml) } 10 11optionsrc(ctx).then((options) => { 12 posthtml() 13 .process(sml, options) 14 .then((result) => console.log(result.html)) 15}))
Maintainer
Michael Ciniawsky |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/20 approved changesets -- 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
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2025-01-27
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