Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
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 template inheritence.
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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.