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.
acetate-folder
Advanced tools
Custom Nunjucks tag that iterates over all the files in a folder.
npm install acetate-folder --save
In your acetate config, which usually resides at acetate.conf.js
add the following to initialize the folder tag:
var folder = require('acetate-folder');
function config(acetate) {
acetate.use(folder());
}
module.exports = config;
Now, in your templates, you can use the folder tag, passing it a glob pattern:
{% folder './*.svg' %}
<div class="FILENAME">FILENAME</div>
{% endfolder %}
This will iterate over every file from your current folder (relative to where the acetate config is) with an extension of .svg
. By default the tag doesn't show files that begin with .
.
The code inside the {% folder %}
tag will be repeated for each file in the folder. Every occurrence of FILENAME
will be replaced by the filename of each file.
For example, if you had the following directory located at /fruit-pics
:
.hidden.svg
bananas.svg
apples.svg
fruit.svg
sub-directory/
And you used the following folder tag:
{% folder './fruit-pics/*.svg' %}
<div class="FILENAME">FILENAME</div>
{% endfolder %}
You'd have the following html when you built your site with Acetate:
<div class="apples">apples</div>
<div class="bananas">bananas</div>
<div class="fruit">fruit</div>
These are returned in alphabetical order with filenames that start with a capital letter being before lowercase filenames.
I think there are a number of options you could make configurable inside the tag itself, like:
.
Pull requests are welcome! Just do your best to maintain the spaces, quotes, syntax, etc of the existing code and we should be good.
FAQs
Custom nunjucks tag that iterates over all the files in a folder
The npm package acetate-folder receives a total of 0 weekly downloads. As such, acetate-folder popularity was classified as not popular.
We found that acetate-folder 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.