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.
gulp-swig-precompile
Advanced tools
Swig precompiler for gulp
Install as a development dependency using npm
npm install --save-dev gulp-swig-precompile
This example makes your templates AMD modules.
var gulp = require('gulp'),
swig = require('gulp-swig-precompile'),
path = require('path');
gulp.task('templates', function () {
gulp.src('views/**/*.html', { base: path.join(__dirname, 'views') })
.pipe(swig({ output: 'define(function () { return <%= template %>; });' }))
.pipe(gulp.dest('public/js'));
});
Note that setting the base path also sets the root directory for the templates, which is useful for templates that make use of the extends
, import
, and include
tags.
You can pass in the same options as those avialble in Swig Options, as well as the desired output format, custom filters, and custom tags.
Default: var tpl = <%= template %>;
An inline template specifying how you would like the results of the precompilation formatted. Two variables are passed in to the template: template
and file
.
Example usage:
{ output: 'exports["<%= file.relative %>"]=<%= template %>;' }
An object containing custom filters, where the keys are filter names, and values are corresponding filter functions.
To learn more on custom filters in Swig, read the official documentation regarding this.
An object containing custom tags, where the keys are tag names, and values are corresponding tag objects with parse
, compile
, ends
, and blockLevel
properties.
To learn more on custom tags in Swig, read the official documentation regarding this.
FAQs
Swig precompiler for gulp
The npm package gulp-swig-precompile receives a total of 0 weekly downloads. As such, gulp-swig-precompile popularity was classified as not popular.
We found that gulp-swig-precompile 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.