New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gulp-nucleus

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-nucleus

An opinionated approach to rendering static HTML using nunjucks

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

gulp-nucleus

An opinionated approach to generating static HTML using gulp and Nunjucks (as of v0.1.0) templates.

What is it?

The plugin is a simple static site generator that:

  • Is designed for use in gulp. See example usage below.
  • Uses Nunjucks for templating.
  • Adds markdown support from marked.
  • Supports YAML front-matter to pass data to swig templates.
  • Supports YAML data files as additional data to pass to swig templates. See example below.
  • Supports generating new pages from YAML data files. See example below.

Basic usage

gulpfile.js

gulp.task('html', () => {
  return gulp.src('html/**/*.html')
    .pipe(gulpNucleus())
    .pipe(gulp.dest('dist'));
});

html/index.html

---
title: hello
---
<!doctype html>
<html>
<head><title>
  {{ title }} <!-- rendered using Nunjucks -->
</title></head>
<body>
Hello world!
</body>
</html>

Using YAML data files

gulpfile.js:

gulp.task('html', () => {
  return gulp.src('html/**/*.html')
    .pipe(gulpNucleus({
      dataPath: 'data'
    }))
    .pipe(gulp.dest('dist'));
});

data/apikeys.yaml:

fooApi: 2346b3166bdb60a0506d

html/index.html:

...
<script src="foo.js?key={{apikeys.fooApi}}"></script>

Generate new pages from YAML data files:

HTML pages that start with a $ are considered generator pages. For example:

gulpfile.js:

gulp.task('html', () => {
  return gulp.src('html/**/*.html')
    .pipe(gulpNucleus({
      dataPath: 'data'
    }))
    .pipe(gulp.dest('dist'));
});

data/people.yaml:

- id: jane
  name: Jane
- id: john
  name: John

html/$person.html:

---
generate:
  collection: people
  variable: person
  filename: '{{person.id}}.html'
---
Hi, my name is {{person.name}}

Keywords

gulpplugin

FAQs

Package last updated on 10 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts