Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
simple-nunjucks-loader
Advanced tools
This Webpack loader compiles Nunjucks templates.
html-webpack-plugin
compatible.
npm install --save-dev simple-nunjucks-loader
Loader didn't expose window.nunjucksPrecompiled
that could break some
installations, that use it directly.
This loader will precompile Nunjucks templates. It also includes Nunjunks (slim) runtime for browser.
Add loader to your webpack
config as follows:
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.njk$/,
use: [
{
loader: 'simple-nunjucks-loader'
}
]
}
]
}
};
For using with html-webpack-plugin
just add it to plugins
array, all options
from it would be available as htmlWebpackPlugin.options
in Nunjucks template.
webpack.config.js
const HTMLWebpackPlugin = require('html-webpack-plugin');
module.exports = {
module: {
rules: [
{
test: /\.njk$/,
use: [
{
loader: 'simple-nunjucks-loader'
}
]
}
]
},
plugins: [
new HTMLWebpackPlugin({
template: 'src/page.njk'
})
]
};
Refer to html-webpack-plugin
page
for all available options.
Nunjunks bundle all precompiled templates to window.nunjucksPrecompiled
, then
loads them via custom loader from this global object.
Loader precompiles all templates in module closure, and pass it down to custom Nunjucks loader, that retrieve templates from closure.
Also Nunjucks didn't have dependency tree for precompiled templates, it cause
precompilation on-demand and will break bundle. To workaround this issue,
simple-nunjucks-loader
doing some regexp-fu and precompile all required
templates.
Loader supports limited number of Nunjuncks options.
It's doesn't support watch
(it's not relate to webpack
files watch),
noCache
, web
settings and express
.
All other options get passed to Nunjunks Environment
during files loading.
FAQs
Webpack loader for Nunjucks
The npm package simple-nunjucks-loader receives a total of 2,612 weekly downloads. As such, simple-nunjucks-loader popularity was classified as popular.
We found that simple-nunjucks-loader 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.