siteforge

1.2.3 • Public • Published

SiteForge Build Status

Powerful Static Website Generator

What Is SiteForge?

SiteForge is a static website generator tool built around a set of assumptions around how a website is structured. It aims to provide more flexibility than previous solutions while still providing much of the power available in templating solutions.

SiteForge websites consist of a number of components, their design will be similar to those used in dynamic websites built using Jade and Express. Namely, a routing table, view templates and static resources.

Advantages

SiteForge gives you the advantages usually only available with dynamic websites, namely the ability to generate content using templates and backing data stores, while still being able to serve static content - reducing server overhead and response times. It has been designed to be easily usable by anyone with experience using common web frameworks like Express.js, and integrates beautifully into your Continuous Deployment toolchain when paired with rsync.

Features

  • Flexible Content Generation SiteForge makes it possible to generate complex static websites using generator functions, allowing you to generate static websites from dynamic data sources.
  • Static Resource Compilation Want to develop in LESS and deploy minified CSS? Do so easily using SiteForge's powerful static resource compilation framework with bundled support for LESS and Jade.

Example Website

var SiteForge = require('siteforge');
 
var forge = new SiteForge({
    views: './views',
    static: './static',
    output: './site'
});
 
forge.locals.menu = [
    { title: 'Home', url: '/' },
    { title: 'Projects', url: '/projects' }
];
 
var projects = {
    project1: { title: 'Project One', abstract: 'projects/project1/abstract' , view: 'projects/project1/page' }
};
 
// Expands :project path components into the array's values
forge.expansions.project = Object.keys(projects);
 
forge.routes = {
    '/': function() {
        this.render('index');
    },
    '/projects': function() {
        this.locals.projects = projects;
        this.render('projects');
    },
    '/:project': function(project) {
        this.locals.project = projects[project];
        this.render('project');
    }
};
 
// Compile website (static and "dynamic" content)
forge.compile();

Hosting Websites

Hosting a SiteForge website is ludicrously simple, all you need is an installation of NGINX and a config file like the following.

server {
    listen 80;

    server_name next.sierrasoftworks.com;

    access_log /web/log/next_access.log;
    error_log /web/log/next_error.log;
    root /web/sierrasoftworks.com;

    error_page 404 = /errors/not_found.html;

    location / {
            if_modified_since exact;
            expires 1m;
            try_files $uri $uri/index.html =404;
    }

    location /errors {
            internal;
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i siteforge

Weekly Downloads

5

Version

1.2.3

License

none

Last publish

Collaborators

  • bpannell