npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

indie-set-core

v1.0.0

Published

Set template rendering engine by Ind.ie

Downloads

6

Readme

set-logo

Set is an unobtrusive and DRY template engine for Node.js and browsers. This package contains the rendering engine for Set.

Get started

To run the demo:

./dev

Visit http://localhost:8000 to see a simple demo.

Compilation

Even if the JavaScript file is included in the repo, the development is done in CoffeeScript and compiled to JavaScript. To compile run:

coffee -c set.coffee

If you don't have CoffeeScript installed, install it with:

sudo npm install -g coffee-script

Installation

Browser

Script tags

Get the set.js file and add your script tags like you always do:

<script src="/static/set.js"></script>

Browserify

Install the module via NPM using:

npm install --save indie-set-core

And use it in your code:

var set = require('indie-set-core')

AMD

Set also supports AMD:

define('myModule', ['set'], function (set) {
  // Write some code here
});

Node.js

Install the module via NPM using:

npm install --save indie-set-core

And use it in your code:

var set = require('indie-set-core')

Use

Regardless the method used to import Set, you'll get a set function which receives a DOM element and data. Data is used to render the DOM element.

NOTE: If used in Node.js a DOM implementation is needed. (See https://ind.ie/labs/set)

var div = document.createElement("div");
document.body.appendChild(div);
template = "\
<ul>\
    <li data-set-repeat='person people'>\
        <a data-set-attribute='href person.homepage'>\
            <p>\
                Hello, my name is <span data-set-text='person.name'>Inigo Montoya</span>\
                <span data-set-if='person.isSpeaker'>Speaker</span>\
            </p>\
        </a>\
    </li>\
</ul>"
data = {
    people: [
            { name: 'Aral', homepage: 'https://aralbalkan.com', isSpeaker: 'yes' }
        ,   { name: 'Laura', homepage: 'http://laurakalbag.com' , isSpeaker: 'yes' }
        ,   { name: 'Jo', homepage: 'http://www.jo-porter.com', isSpeaker: 'yes' }
        ,   { name: 'Osky', homepage: 'http://twitter.com/gigapup' }
    ]
}

div.innerHTML = template;
set(div, data);
/* Puts this in the body:
  <div>
    <ul>
      <li data-set-repeat="person people">
        <a data-set-attribute="href person.homepage" href="https://aralbalkan.com"></a>

        <p>Hello, my name is <span data-set-text="person.name">Aral</span>
        <span data-set-if="person.isSpeaker">Speaker</span></p>
      </li>

      <li data-set-alias="person people 1" data-set-dummy="1">
        <a data-set-attribute="href person.homepage" href="http://laurakalbag.com"></a>

        <p>Hello, my name is <span data-set-text="person.name">Laura</span>
        <span data-set-if="person.isSpeaker">Speaker</span></p>
      </li>

      <li data-set-alias="person people 2" data-set-dummy="1">
        <a data-set-attribute="href person.homepage" href="http://www.jo-porter.com"></a>

        <p>Hello, my name is <span data-set-text="person.name">Jo</span>
        <span data-set-if="person.isSpeaker">Speaker</span></p>
      </li>

      <li data-set-alias="person people 3" data-set-dummy="1">
        <a data-set-attribute="href person.homepage" href=
        "http://twitter.com/gigapup"></a>

        <p>Hello, my name is <span data-set-text="person.name">Osky</span>
        <span data-set-if="person.isSpeaker" style="display: none;">Speaker</span></p>
      </li>
    </ul>
  </div>
*/

Credits

Set extends the excellent Distal template engine which is an implementation of the Template Attribute Language (TAL) concept from Zope.

Copyright © Aral Balkan. Released with ♥ by Ind.ie under the MIT License. Portions released under the Apache License.