Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
metalsmith-prefix
Advanced tools
A metalsmith plugin to prefix internal URLs on your site. Helpful for deploying to nested urls (like example.com/blog) while developing locally. Written because metalsmith-prefixoid wasn't working for me.
It rewrites all absolute internal URLs to use this prefix, but no external or relative ones. So the rendered html
<a href="http://example.com"></a>
<a href="path/to/url"></a>
<a href="/path/to/url"></a>
Would become this when prefixed with 'prefix'
<a href="http://example.com"></a>
<a href="path/to/url"></a>
<a href="/prefix/path/to/url"></a>
npm install metalsmith-prefix
Because metalsmith-prefix
parses output HTML, it should be placed near the end of your plugin chain, after all your templates have already been rendered.
Install through npm and then add the metalsmith-prefix
key to your metalsmith.json
.
{
"plugins": {
"metalsmith-prefix": "blog"
}
}
Or by passing in options
{
"plugins": {
"metalsmith-prefix": {
"prefix": "blog",
"selector": "a, img, link, script"
}
}
}
Pass options
to the plugin and pass it to Metalsmith with the use
method:
var prefix = require('metalsmith-prefix')
metalsmith.use(prefix({
prefix: 'blog',
selector: 'a, img, link, script'
}))
You can pass options to metalsmith-prefix
with the Javascript API or CLI. The options are:
The prefix used to rewrite urls.
The selector used to find elements with URLs to rewrite. Metalsmith-prefix uses cheerio to parse any HTML outputs for URLs and rewrites them. This option defaults to a, link, script, img, video, audio, source
MIT
FAQs
A metalsmith plugin to prefix internal URLs
The npm package metalsmith-prefix receives a total of 1 weekly downloads. As such, metalsmith-prefix popularity was classified as not popular.
We found that metalsmith-prefix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.