Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-swig-precompile

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-swig-precompile

Swig precompiler for gulp

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

gulp-swig-precompile Build Status

Swig precompiler for gulp

Install

Install as a development dependency using npm

npm install --save-dev gulp-swig-precompile

Example

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'));
});

API

swig(options)

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.

output

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: 'templates.register("<%= file.relative %>", <%= template %>);' }
filters

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.

tags

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.

Keywords

FAQs

Package last updated on 14 Feb 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc