All Projects → paularmstrong → Swig

paularmstrong / Swig

Licence: mit
Take a swig of the best template engine for JavaScript.

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to Swig

page-metadata-service
DEPRECATED - A RESTful service that returns the metadata about a given URL.
Stars: ✭ 18 (-99.42%)
Mutual labels:  unmaintained
addon-sdk-content-scripts
DEPRECATED | Use WebExtensions instead | Add-ons demonstrating how to use content scripts in the Add-on SDK.
Stars: ✭ 23 (-99.26%)
Mutual labels:  unmaintained
Colors Of Image
A PHP Library for getting colors from images DEPRECATED
Stars: ✭ 273 (-91.28%)
Mutual labels:  unmaintained
2015-foia-hub
A consolidated FOIA request hub.
Stars: ✭ 47 (-98.5%)
Mutual labels:  unmaintained
id-specs
INACTIVE - http://mzl.la/ghe-archive - Specifications for Mozilla's Identity Effort
Stars: ✭ 91 (-97.09%)
Mutual labels:  unmaintained
rescuefox
DEPRECATED - demo game to drive 3D engine creation: rescue your pet space fox!
Stars: ✭ 35 (-98.88%)
Mutual labels:  unmaintained
icongrid
INACTIVE - http://mzl.la/ghe-archive - IconGrid.js makes it easy to display a scrollable grid of icons!
Stars: ✭ 25 (-99.2%)
Mutual labels:  unmaintained
Rust Os Comparison
A comparison of operating systems written in Rust
Stars: ✭ 292 (-90.67%)
Mutual labels:  unmaintained
Garmr
INACTIVE - Security Testing Tool
Stars: ✭ 105 (-96.64%)
Mutual labels:  unmaintained
confidential-survey
A Rails app for conducting confidential surveys without violating user privacy
Stars: ✭ 29 (-99.07%)
Mutual labels:  unmaintained
vinz-clortho
INACTIVE - http://mzl.la/ghe-archive - BrowserID Keymaster for LDAP enabled Identity Providers
Stars: ✭ 16 (-99.49%)
Mutual labels:  unmaintained
rilproxy
DEPRECATED
Stars: ✭ 21 (-99.33%)
Mutual labels:  unmaintained
elmo
DEPRECATED - Elmo ~ https://mozilla.github.io/elmo/
Stars: ✭ 32 (-98.98%)
Mutual labels:  unmaintained
cleverbot
Deprecated/unmaintained. See https://www.cleverbot.com/api/
Stars: ✭ 23 (-99.26%)
Mutual labels:  unmaintained
Wifi
[unmaintained] WiFi tools for linux
Stars: ✭ 281 (-91.02%)
Mutual labels:  unmaintained
calculator
INACTIVE - http://mzl.la/ghe-archive - Resurrection of the calculator app that was pulled from gaia
Stars: ✭ 16 (-99.49%)
Mutual labels:  unmaintained
web-forward
DEPRECATED - Innovation acceleration program from Mozilla Labs
Stars: ✭ 17 (-99.46%)
Mutual labels:  unmaintained
Redditkit
An Objective-C wrapper for the reddit API
Stars: ✭ 299 (-90.44%)
Mutual labels:  unmaintained
Mobx Store
A data store with declarative querying, observable state, and easy undo/redo.
Stars: ✭ 283 (-90.96%)
Mutual labels:  unmaintained
coma
a console mail user agent | obsolete: use mblaze
Stars: ✭ 13 (-99.58%)
Mutual labels:  unmaintained

NOT MAINTAINED

Fork and use at your own risk.

Swig Build Status Dependency Status NPM version NPM Downloads

Swig is an awesome, Django/Jinja-like template engine for node.js.

Features

  • Available for node.js and major web browsers!
  • Express compatible.
  • Object-Oriented template inheritance.
  • Apply filters and transformations to output in your templates.
  • Automatically escapes all output for safe HTML rendering.
  • Lots of iteration and conditionals supported.
  • Robust without the bloat.
  • Extendable and customizable. See Swig-Extras for some examples.
  • Great code coverage.

Need Help? Have Questions? Comments?

Installation

npm install swig

Documentation

All documentation can be viewed online on the Swig Website.

Basic Example

Template code

<h1>{{ pagename|title }}</h1>
<ul>
{% for author in authors %}
    <li{% if loop.first %} class="first"{% endif %}>{{ author }}</li>
{% endfor %}
</ul>

node.js code

var swig  = require('swig');
var template = swig.compileFile('/absolute/path/to/template.html');
var output = template({
    pagename: 'awesome people',
    authors: ['Paul', 'Jim', 'Jane']
});

Output

<h1>Awesome People</h1>
<ul>
    <li class="first">Paul</li>
    <li>Jim</li>
    <li>Jane</li>
</ul>

For working example see examples/basic

How it works

Swig reads template files and translates them into cached javascript functions. When we later render a template we call the evaluated function, passing a context object as an argument.

License

Copyright (c) 2010-2013 Paul Armstrong

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].