1.0.4 • Published 5 years ago

create-menu v1.0.4

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
5 years ago

CreateMenu

Create Menu creates an HTML menu from a JSON object. It also includes CSS and ES5 compatible JS to operate the menu.

Table of Contents

  • Installation
  • Usage
  • JSON Structure

  • @param {JSON} navObj a (JSON) object of the nav

  • @param {string} optional siteHeaderHTML a string containing the blank site header
  • @param {string} optional menuStub a stub to replace in the siteHeaderHTML, ex: <!-- MENU_STUB -->

@returns {string} the generated menu HTML

JSON Structure

See example/example-menu.json

CreateMenuTaskRunner with Node

createMenu can run from the command line with a small taskRunner file. It's executed by running, node createMenuTaskRunner.js

Webpack integration

/* global require */
const fs = require('fs')
const createMenu = require('createMenu')
const menuJSON = require('./menu.json')

const MENU_STUB = '<!-- MENU_STUB -->'
let blankSiteHeader
fs.readFile('./public/site-header/site-header.html', function (err, data) {
  if (err) throw err
  blankSiteHeader = data.toString()
})

const menu = createMenu.create(menuJSON, blankSiteHeader, MENU_STUB)
console.log(menu)
1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago