ae86
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Old school static website generator
Avatar

[![Build Status](https://github.com/cliffano/ae86/workflows/CI/badge.svg)](https://github.com/cliffano/ae86/actions?query=workflow%3ACI)
[![Vulnerabilities Status](https://snyk.io/test/github/cliffano/ae86/badge.svg)](https://snyk.io/test/github/cliffano/ae86)
[![Dependencies Status](https://img.shields.io/david/cliffano/ae86.svg)](http://david-dm.org/cliffano/ae86)
[![Coverage Status](https://img.shields.io/coveralls/cliffano/ae86.svg)](https://coveralls.io/r/cliffano/ae86?branch=master)
[![Published Version](https://img.shields.io/npm/v/ae86.svg)](http://www.npmjs.com/package/ae86)

AE86 ---- AE86 is an old school static website generator written in Node.js . This is handy when you want to create a static website by specifying simple templates, along with custom variables and template functions. All you need to know is standard HTML, JavaScript, CSS, and a bit of simple Jazz templating, nothing fancy. Installation ------------ npm install -g ae86 Usage ----- Create example AE86 project: ae86 init An AE86 project has the following structure: * partials/ - directory containing partial templates * layouts/ - directory containing layout templates * pages/ - directory containing page templates * params.js - file containing custom variables and template functions Generate website (written to out/ directory): ae86 gen Watch for changes and automatically regenerate website: ae86 watch Or, for AE86 historians, use this alias for watch: ae86 drift Remove website: ae86 clean To use custom directory for the generated website: ae86 gen --out-dir public ae86 watch --out-dir public ae86 clean --out-dir public Template & Parameters --------------------- AE86 uses [shinetech/jazz](https://github.com/shinetech/jazz) as its template engine, checkout Jazz documentation for further syntax documentation. __Partials__ Partial templates can be used for fragments of the website, e.g. website header, footer, and navigation, which appear on multiple pages. Partial templates can be included in other templates using {include('partial.html')} template function. __Layouts__ Layout templates are applied to each page. By default, all pages use layouts/default.html unless otherwise specified in params.js' sitemap. Page content is rendered in layout using {content} variable. __Pages__ Each page template will be applied a layout, and evaluated into a static HTML page. __Static__ Place all static files (e.g. images, scripts, styles, robots.txt) in static directory. The directory structure of static files will be kept as-is. If there's any conflict with the page templates, the page template will overwrite the static file. __Custom Variables__ Website custom variables and template functions can be specified in exports.params object in params.js file: exports.params = { subtitle: 'Small, lightweight, since 1983.', team: ['Keiichi Tsuchiya', 'Mitsu Ide', 'Dori-Kin'] } These parameters can then be used in a template file:

{subtitle}

    {foreach person in team}
  • {person}
  • {end}
You also need to specify the sitemap in params.js file. The key should match the page file names under the pages directory, title and layout can optionally be specified as the value. Layout value must be relative to layouts directory, e.g. layout: brochure.html uses layouts/brochure.html . If layout is not specified, then layouts/default.html will be used. exports.params = { sitemap: { 'index.html': { title: 'Home Page' }, 'products/corolla.html': { title: 'Toyota Corolla', layout: 'brochure.html' }, 'products/sprinter.html': { title: 'Toyota Sprinter', layout: 'brochure.html' }, 'contact.html': { title: 'Contact Us' } } } Note that params.js is a Node.js module, so it can require other modules accordingly. __Custom Template Functions__ Custom template functions can be specified in params.js : exports.params = { copyright: function (year, name, cb) { cb('Copyright © ' + year + ' ' + name + '. Some Rights Reserved.'); } } Note that a custom template function must have a callback(result) as the last argument, result will then be rendered on the template. The custom copyright template function above can then be used in a template file:

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。