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

artist

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

artist

Template engine for node.js built on fest

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Artist

Build Status

Artist is a template engine for node.js built on fest.

Features:

  • Caches compiled templates
  • Synchronous and asynchronous API
  • Express-compatible
  • Handles fest's runtime errors
  • Connect's middleware proxy

Installation

npm install artist

API

View source for documentation.

Usage

With express:

app.engine('xml', require('artist').render());

With express (production environment):

app.engine('xml', require('artist').render({
    cache: true,
    debug: false
}));

Synchronous version:

var render = require('artist').renderSync();
// ...
var html = render('index.xml', {foo: 'bar'});

index.xml

<?xml version="1.0"?>
<fest:template xmlns:fest="http://fest.mail.ru" context_name="json">
    <fest:value>json.foo</fest:value>
</fest:template>

Proxy

Proxy is a connect middleware. It handles requests to the templates, compiles them and wraps results into AMD module, JSONP or any other format.

AMD:

app.use(require('artist').proxy({
    format: 'amd', // 'amd', 'jsonp' or any string with #ID# and #FN# placeholders
    route: '/scripts/templates', // middleware mounting point
    templates: app.get('views') // path to the view directory
}));

GET /scripts/templates/layout.js

define(function(){return function(__fest_context){
    ...
}});

JSONP:

app.use(require('artist').proxy({
    format: 'jsonp',
    route: '/scripts/templates',
    templates: app.get('views')
}));

GET /scripts/templates/layout.js?jsonp=handleTemplate

handleTemplate(function(__fest_context){
    ...
});

Keywords

FAQs

Package last updated on 03 Mar 2013

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