html-factory
It is a tool that replicates the HTML from excel and HTML templates.
Last updated 6 years ago by tomoaki .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install html-factory 
SYNC missed versions from official npm registry.

html-factory

It is a tool that replicates the HTML from excel and HTML templates.

Install

npm install html-factory

How To Use

  1. First, edit the template
  2. Then edit the Excel
  3. Convert object array coming from Excel to last

template edit

I follow the notation of the mustache

sample

View:

{
  "name": {
    "first": "Michael",
    "last": "Jackson"
  },
  "age": "RIP"
}

Template:

* {{name.first}} {{name.last}}
* {{age}}

Output:

* Michael Jackson
* RIP

See below for details

Convert object array

object['template'] and object['path'] is required.

  • File is saved in dest folder while maintaining the structure of the value of object['path']
  • look for a object['template'] value file from a template folder
var Factory = require('html-factory');

new Factory.Model().fetch('./src/spreadsheets/data.xlsx').then(function (array) {

  array.shift();

  var data = array.map(function (e, i) {
    return {
      path:     e[0],
      template: e[1],
      name: {
        first: e[2],
        last:  e[3]
      },
      stooges: e.slice(4, 7).map(function(e, i) {
        return {
          name: e
        }
      }),
      musketeers: e.slice(7)
    }
  });

  Factory.inspect(data);

  data.forEach(function (e, i) {
    new Factory.View().dump(e);
  });

});

test command

$ npm test

start command

$ npm start

Current Tags

  • 0.0.2                                ...           latest (6 years ago)

3 Versions

  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 3
Dependencies (6)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |