JSPM

mini-coffeecup

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q26124F
  • License MIT

Minimalist CoffeeCup.js

Package Exports

  • mini-coffeecup

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mini-coffeecup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Why MiniCoffeeCup? Ú³ υ³

Inspired by coffeecup, and ck, and mini-handlebars libraries.

NOTICE:

As I was developing mini-coffeecup, I had a better idea which became coffee-templates. I will still keep mini-coffeecup around for posterity, but no new features are likely to be added.

Quick Example

# this line is only required within node
MiniCoffeeCup = require 'mini-coffeecup'

# initialize new engine
coffeecup = new MiniCoffeeCup format: true

# provide template expression
template = (data) ->
  doctype 5
  html ->
    head ->
      title @title
    body ->
      p 'Hello, {{name}}!'
      p 'Here are your Christmas lists ({{santa_laugh}}):'
      table ->
        thead ->
          tr ->
            block 'each children, name', ->
              th '{{name}}'
        tbody ->
          tr ->
            block 'each children, name', ->
              td ->
                block 'each list', ->
                  ul ->
                    li '{{this}}'

# for example
locals =
  title: 'Christmas List'

# render coffeecup template to html
console.log coffeecup.render template, locals

As usual, for the latest examples, review the easy-to-follow ./test/test.coffee.

Or try it immediately in your browser with codepen.

TODO

  • support inline stylus?