All Projects → foundation → Panini

foundation / Panini

Licence: other
A super simple flat file generator.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Panini

Vscode Data Preview
Data Preview 🈸 extension for importing 📤 viewing 🔎 slicing 🔪 dicing 🎲 charting 📊 & exporting 📥 large JSON array/config, YAML, Apache Arrow, Avro, Parquet & Excel data files
Stars: ✭ 245 (-56.41%)
Mutual labels:  json, yaml, data
Just Dashboard
📊 📋 Dashboards using YAML or JSON files
Stars: ✭ 1,511 (+168.86%)
Mutual labels:  json, yaml, data
Tmuxp
💻 tmux session manager. built on libtmux
Stars: ✭ 3,269 (+481.67%)
Mutual labels:  json, yaml
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+511.92%)
Mutual labels:  json, data
Pico
Pico is a stupidly simple, blazing fast, flat file CMS.
Stars: ✭ 3,494 (+521.71%)
Mutual labels:  flat-file, yaml
Dyff
/ˈdʏf/ - diff tool for YAML files, and sometimes JSON
Stars: ✭ 277 (-50.71%)
Mutual labels:  json, yaml
Json Schema Validator
A fast Java JSON schema validator that supports draft V4, V6, V7 and V2019-09
Stars: ✭ 292 (-48.04%)
Mutual labels:  json, yaml
Jk
Configuration as Code with ECMAScript
Stars: ✭ 322 (-42.7%)
Mutual labels:  json, yaml
bootstrap-gulp-starter-template
Bootstrap 4 + Gulp 4 + Panini for improve front-end development workflow
Stars: ✭ 67 (-88.08%)
Mutual labels:  gulp, handlebars
Packagedev
Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
Stars: ✭ 378 (-32.74%)
Mutual labels:  json, yaml
Choetl
ETL Framework for .NET / c# (Parser / Writer for CSV, Flat, Xml, JSON, Key-Value, Parquet, Yaml, Avro formatted files)
Stars: ✭ 372 (-33.81%)
Mutual labels:  json, yaml
Tabulator
Interactive Tables and Data Grids for JavaScript
Stars: ✭ 4,329 (+670.28%)
Mutual labels:  json, data
Korio
Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
Stars: ✭ 282 (-49.82%)
Mutual labels:  json, yaml
Quranjson
Quran JSON ~ 6236 verses, 114 surah, 30 Juz
Stars: ✭ 278 (-50.53%)
Mutual labels:  json, data
Envfile
EnvFile 3.0 is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
Stars: ✭ 293 (-47.86%)
Mutual labels:  json, yaml
Quicklib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Config, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Stars: ✭ 274 (-51.25%)
Mutual labels:  json, yaml
Browser Compat Data
This repository contains compatibility data for Web technologies as displayed on MDN
Stars: ✭ 3,710 (+560.14%)
Mutual labels:  json, data
Remarshal
Convert between CBOR, JSON, MessagePack, TOML, and YAML
Stars: ✭ 421 (-25.09%)
Mutual labels:  json, yaml
startover
Startover is a boilerplate for developing static websites. With Startover you don't have to start over!
Stars: ✭ 15 (-97.33%)
Mutual labels:  gulp, handlebars
lnv-mobile-base
移动端开发脚手架-基于gulp的使用zepto、handlebars、sass并且带移动端适配方案(flexible.js)的前端工作流,旨在帮助移动端项目的开发
Stars: ✭ 41 (-92.7%)
Mutual labels:  gulp, handlebars

Panini

Build Status npm version Dependency Status

A super simple flat file generator for use with Gulp. It compiles a series of HTML pages using a common layout. These pages can also include HTML partials, external Handlebars helpers, or external data as JSON or YAML.

Panini isn't a full-fledged static site generator—rather, it solves the very specific problem of assembling flat files from common elements, using a templating language.

Installation

npm install panini --save-dev

Usage

Feed Panini a stream of HTML files, and get a delicious flattened site out the other end.

var gulp = require('gulp');
var panini = require('panini');

gulp.task('default', function() {
  gulp.src('pages/**/*.html')
    .pipe(panini({
      root: 'pages/',
      layouts: 'layouts/',
      partials: 'partials/',
      helpers: 'helpers/',
      data: 'data/'
    }))
    .pipe(gulp.dest('build'));
});

Note that Panini loads layouts, partials, helpers, and data files once on first run. Whenever these files change, call panini.refresh() to get it up to date. You can easily do this inside a call to gulp.watch():

gulp.watch(['./src/{layouts,partials,helpers,data}/**/*'], [panini.refresh]);

Options

root

Type: String

Path to the root folder all pages live in. This option does not pull in the files themselves for processing—that's what gulp.src() is for. This setting tells Panini what the common root of your site's pages is.

layouts

Type: String

Path to a folder containing layouts. Layout files can have the extension .html, .hbs, or .handlebars. One layout must be named default. To use a layout other than the default on a specific page, override it in the Front Matter on that page.

---
layout: post
---

<!-- Uses layouts/post.html as the template -->

All layouts have a special Handlebars partial called body which contains the contents of the page.

<!-- Header up here -->
{{> body}}
<!-- Footer down here -->

pageLayouts

Type: Object

A list of presets for page layouts, grouped by folder. This allows you to automatically set all pages within a certain folder to have the same layout.

panini({
  root: 'src/pages/',
  layouts: 'src/layouts/',
  pageLayouts: {
    // All pages inside src/pages/blog will use the blog.html layout
    'blog': 'blog'
  }
})

partials

Type: String

Path to a folder containing HTML partials. Partial files can have the extension .html, .hbs, or .handlebars. Each will be registered as a Handlebars partial which can be accessed using the name of the file. (The path to the file doesn't matter—only the name of the file itself is used.)

<!-- Renders partials/header.html -->
{{> header}}

helpers

Type: String

Path to a folder containing Handlebars helpers. Handlebars helpers are .js files which export a function via module.exports. The name used to register the helper is the same as the name of the file.

For example, a file named markdown.js that exports this function would add a Handlebars helper called {{markdown}}.

var marked = require('marked');

module.exports = function(text) {
  return marked(text);
}

data

Type: String

Path to a folder containing external data, which will be passed in to every page. Data can be formatted as JSON (.json) or YAML (.yml). Within a template, the data is stored within a variable with the same name as the file it came from.

For example, a file named contact.json with key/value pairs such as the following:

{
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "555-1212"
}

Could be used to output the value of John Doe within a template using the Handlebars syntax of {{contact.name}}.

Data can also be a .js file with a module.exports. The data returned by the export function will be used.

Data can also be inserted into the page itself with a Front Matter template at the top of the file.

Lastly, the reserved page variable is added to every page template as it renders. It contains the name of the page being rendered, without the extension.

CLI

You can also use panini via the CLI.

Usage: panini --layouts=[layoutdir] --root=[rootdir] --output=[destdir] [other options] 'pagesglob'

Options:
  --layouts  (required) path to a folder containing layouts
  --root     (required) path to the root folder all pages live in
  --output     (required) path to the folder compiled pages should get sent to
  --partials            path to root folder for partials
  --helpers             path to folder for additional helpers
  --data                path to folder for additional data

the argument pagesglob should be a glob describing what pages you want to apply panini to.

Example: panini --root=src/pages --layouts=src/layouts --partials=src/partials --data=src/data --output=dist 'src/pages/**/*.html'

Local Development

git clone https://github.com/foundation/panini
cd panini
npm install

Use npm test to run tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].