Socket
Socket
Sign inDemoInstall

stencil

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

stencil

Asynchronous HTML5 and XML templates for Node.js and the browser.


Version published
Weekly downloads
862
decreased by-34.89%
Maintainers
1
Weekly downloads
 
Created
Source

stencil

Stencil Build Status Coverage Status

Asynchronous HTML5 templating for Node.js and the browser. Photo by mufflevski.

Thoughts on Stencil? Join the Discussion.

Synopsis

Layouts.

<s:include xmlns:s="stencil">
  <s:tag name="document">
    <html>
    <head>
      <title><s:value select="attr.title"/></title>
      <s:block name="head"/>
    </head>
    <body>
      <h1><s:value select="attr.title"/></h1>
      <s:block name="body"/>
    </body>
    </html>
  </s:tag>
</s:include>

Pages laid out.

<o:document xmlns:s="stencil" xmlns:o="inc:layout.stencil" title="Hello, World!">
  <o:head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></o:head>
  <o:body><p>Hello, World!</p></o:body>
</o:document>

The same templates run on the browser and in Node.js, so you can use the same logic you use to serve a generate page to refresh that page.

Stencil on the Server

On the server, we create a template and serialize it to HTML5. You can also serialize to older HTML flavors for older browsers.

Stencil on the Browser

On the browser, when we generate Stencil XML, we simply import it into the existing DOM using Document.adoptNode.

Remember

  • It's not a query tool. It's a templating tool.

Expand

  • Functions must have no side-effects; i.e. do not use your template functions to create a hit counter.
  • It's not hard to write template functions that do not have side effects. The sort of functions that might have side effects are not likely to appear in the logic that supports emitting markup.

Motivations

Revisiting the ideas explored in a Java based Stencil.

Stencil is asynchronous HTML5 templating for Node.js and the browser. It based on some ideas from yesteryear and some ideas from tomorrow.

This project evolved from work with Streamline and CoffeeScript. That work has been moved to a project named Pastiche.

Philosophy

Especially when dealing with a library that has a goal of being small, you're limited as to how much scaffolding you can offer developers. My approach for Stencil is to define three roles, application developer, web developer, and web designer, and say the first two roles labor to create a childlike sense of wonder in the latter role.

An application developer creates APIs that the web developer can query. The web developer wraps those APIs in tag libraries, so that the web designer can focus on semantic layout.

Change log

Changes for each release.

Version 0.0.5

Mon Apr 22 19:07:43 UTC 2013

  • Fix non-directive with attribute child directives. #108.

Version 0.0.4

Tue Apr 16 14:15:19 UTC 2013

  • Add request and response to Stencil service. #106.

Keywords

FAQs

Package last updated on 22 Apr 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