npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

statix

v2.0.5

Published

Static website generator. Template Engine agnostic

Downloads

43

Readme

Statix is a super-simple, static website generator.

Statix uses the Swig as the templating engine (if you're familiar with Django templates, Jinja or Twig, you'll feel right at home).

Installation

$ npm install -g statix

Getting Started

$ statix new project-name
$ cd project-name
$ statix build

Run those three commands, then compare the source and deploy directories.

Local webserver

Statix uses express (with nodemon to restart the server on changes), which means you don't have to build everytime you make a change.

$ cd project-name
$ statix server

About the statix.js config file

All the config for Statix, happens through the statix.js file. This is the only mandatory file for any Statix project. If you cd into a directory with a statix.js file in it, you can run the commands statix build and statix server, it's that simple.

It's all pretty self explantory and there are plenty of comments. The cool thing is that you can grab a bunch of data from a database and pass it to Statix for use in generating your static site.

var settings = {
	
	source_dir : "source", // `source_dir` is the directory where all your source files are.
	output_dir: "deploy", // `output_dir` is the directory you want to compile your static site to.

	/*
		Literal regexes here. Statix won't include anything, unless it matches an `include_pattern` and also does 
		not match an `exclude_pattern`. Checks against the full path, i.e. /Users/your.name/some/dir/site/blah.html
	*/

	include_patterns : [
		/^(.*)$/
	],

	exclude_patterns : [
		/^(.*)(base\.html{1})$/,
		/^(.*)(\/templates{1})(.*)$/
	],

	/*
		An array of the pages to be rendered with the template engine.
	
		`output` is where your page will eventually live, in the static version of the site. I.e. "{output_dir}/{page.output}"
		
		`source` is where your template lives. I.e. "{source_dir}{page.source}"
		
		`data` is an object of variables you want to pass through to the template when it gets rendered.
	*/

	pages : [
		{
			output : "index.html",
			source : "templates/index.html",
			data : {}
		},		

		{
			output : "example.html",
			source : "templates/example.html",
			data : {}
		}
	],

	/*
		`global_data` is an object that gets passed to all pages. Note, if you set `global_data.someProp` to something
		and also have `page.data.someProp`, the latter will take precedence.
	*/

	global_data: {

	},

	/*
		Like `global_data`, but `build_data` only gets passed to the renderer when you build, not when viewing locally through the webserver.
		`build_data` properties take precedence over `global_data` properties.
	*/

	build_data : {
		
	},

	// Misc. things to pass to express for the local web server, currently the only value used is port.
	express : {
		port: "8000"
	},

	/*
		If you need to process some things before you're ready to generate the pages (either through the web server or compilation),
		you can use this `ready` method. Common use case, you need to grab a bunch of data from a database, and are using asynch i/o
		Statix, does nothing until the `callback` passed to this method is called, so once you are done with everything you need to do,
		simply call `callback();`
	*/

	ready : function (callback) {
		callback();	
	},

	/*
		Statix gives you a hook to do whatever you want before the build actually happens. You can use this method to minify js/css,
		compile scss stylesheets, etc. Just be sure to invoke the `done()` function when you are ready for Statix to do it's thing.
	*/

	preBuild : function (done) {
		done();
	},

	/*
		Just like `preBuild()` but this method gets called after Statix has generated the static site. You can use this to
		cleanup some files, git commit/push, or whatever you feel like. Just be sure to invoke the `done()` function afterwards.
	*/
	postBuild : function (done) {
		done();
	}

}

module.exports = settings;

Support for other template engines is planned and fairly ease to implement if you want to fork it :)