0.0.9 • Published 10 years ago

compot v0.0.9

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

compot

Component-like template engine.

Get Started

The recommended way to use compot is using gulp plugin.

Install

(sudo) npm install -g compot

usage

Command Line Intergace

compot src dest

Node.js

var compot = require('compot'),
    fs = require('fs');

var src = fs.readFileSync('path/to/src', 'utf8');

compot.render(src, {
    root: 'path/to/root'
}, function(err, res){
    fs.writeFileSync(res, 'path/to/dest', 'utf8');
});

compot.render(source, option, callback)

return converted html string.

parmeters
nametypedescription
sourcestringsource html string
optionObjectoptions(optional)
option.rootstringroot directory which is used in resolving import compot file
callbackFunctioncalled as callback(Error, string)

example

<!-- main.html -->

<link rel="compot" href="./my-tag.html">

<my-tag class="foo" title="Compot!">
    This is <b>my custom tag</b>
</my-tag>
<!-- my-tag.html -->

<template type="compot" name="my-tag">
    <div class="buz">
        <header>{{title}}</header>
        <p>
            <content></content>
        </p>
    </div>
</template>
# CLI
compot ./main.html ./build.html

The output is,

<!-- build.html -->
<div class="buz foo">
    <header>Compot!</header>
    <p>
        This is <b>my custom tag</b>
    </p>
</div>
0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago