1.0.2 • Published 10 years ago

spirit-site-data v1.0.2

Weekly downloads
4
License
MIT
Repository
-
Last release
10 years ago

Spirit Site Data

Summary

A simple template data generator for the Spirit Core static file generator.

Syntax

Install the Spirit Core through npm.

npm install spirit-core.
var config = {
  site : {
    data : {
      title : "A spirit blog.",
      description : "Something awesome."
    }
  }
} ;

var SpiritCore     = require( 'spirit-core' ) ;
var spirit         = new SpiritCore( ".", config ) ;
var spiritData     = spirit.getData( ) ;
var spiritSiteData = spiritData.site ;

console.log( spiritData.site ) ;

/* RETURNS =>
  {
    title : "A spirit blog",
    description : "Something awesome."
  }
*/

Properties

spiritData.site The data object containing all template data

Configuration

There are three ways to pass data into the site property

  1. Through the Spirit Core configuration files site property.
  // In "_config.json"
  {
    site : {
      // put data here
    }
  }
  1. Programmatically to the Spirit Core constructor .
  var config = {
    site : {
      // put data here
    }
  }
  var SpiritCore = require( 'spirit-core' ) ;
  var spirit = new SpiritCore( '/root/path', config )
  1. By specifying a src path in the site config
  var config = {
    site : {
      src : 'siteData.json'
    }
  } ;
  var SpiritCore = require( 'spirit-core' ) ;
  var spirit = new SpiritCore( 'root/path', config ) ;

  /* in "siteData.json"
    {
      // put data here
    }
  */
  1. By including a site.json file in the source directory
  /* in "_site.json"
    {
      // put data here
    }
  */

Handmade in San Francisco California by Alex Ray

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.1

10 years ago