Giter Site home page Giter Site logo

pukit's Introduction

pukit

一个 pug mixin 工具包,一种维护 HTML 的简单模式:

配置 + 模板 = HTML

model.js

'use strict';

var models = {
    context1: {
        Person: {
            fields: {
                name: {
                    displayName: 'Name',
                    type: 'string'
                },
                birth: {
                    displayName: 'Birthday',
                    type: 'date'
                }
            }
        }
    }
}

module.exports = models;

template.pug

---
model: Person
---

+navbar
  +nav
    +nav-item #{model.fields.name.displayName}
    +nav-item #{model.fields.birth.displayName}

+editor-for-model(model)

output.html

<ul class="nav" role="tablist">
    <li class="nav-item" role="presentation">
        <a class="nav-link" href="javascript:;">Name</a>
    </li>
    <li class="nav-item" role="presentation">
        <a class="nav-link" href="javascript:;">Birthday</a>
    </li>
</ul>

<div class="form-group row">
    <label class="control-label col-xs-3">Name</label>
    <div class="col-xs-9 form-control-container">
    <input class="form-control" type="text" data-bind="value: data.name" name="name"/>
    </div>
</div>
<div class="form-group row">
    <label class="control-label col-xs-3">Birthday</label>
    <div class="col-xs-9 form-control-container">
    <input class="form-control date" readonly="readonly" data-bind="date: data.birth" name="birth"/>
    </div>
</div>

Doc

http://gochant.github.io/pukit/doc.html

(开始写了一点点)

pukit's People

Contributors

youchant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.