The Progressive & Scriptable Static Site Generator
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
bin
github-assets
src
test-output
test
testing-folder
.eslintrc.json
.gitignore
.npmignore
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

pitch

Pitch Version Pitch Dependencies Pitch License

Linux Windows
CircleCI AppVeyor

⚠️ Work in progress. API might change. ⚠️

The Progressive & Scriptable Static Site Generator.

The objetive of pitch is to provide a powerful tool capable of building static websites progressively. Just a src folder should be enough to build a static website.

Install

npm install -g pitch-cli

Usage

Create a file structure like this:

MyWebsite/
    src/
        index.html
        style.css

Running pitch serve inside MyWebsite will run a web server in http://127.0.0.1:3000. Access it from the browser check that it's working.

Now change the index.html extension to .ejs and the style's to .scss, change the contents of the files, add new styles and reference them from index.ejs, or create some partials.

As you can see, pitch takes care of building the needed resources as you request them. It just works.

Data

To include data into your website, just create a data folder with some JSON files in it:

MyWebsite/
    src/
        index.ejs
        style.scss
    data/
        people.json

Inside people.json:

["John", "Charles", "Thomas"]

Inside index.ejs:

<p>People: <%= data.people.join(", "); %></p>

And that's all you need to do to include data into your website. Change any file's contents and reload the page in the browser, it gets re-compiled automatically.

The data proxy is able to navigate into folders too.

MyWebsite/
    data/
        articles/
            helloWorld.md
<article>
    <%- data.articles.helloWorld.html %>
</article>

Pitch understands many file formats inside it's data folder:

  • .json: Gets JSON.parse()'d.
  • .js: Gets require()'d.
  • .md: Parsed with remark.

If the file isn't any of these formats, will read it like a plain text file.

Router

Documentation is on the way.

Why

Got really tired of configuring stuff to build a simple website that I need right now because whatever.

Regular static site generators tie you to 'blogs' or websites with pages. Wanted something that isn't oriented to a certain type of website and gave me everything I needed, instead of requiring some extra build tasks to transpile something.

Also, many of them require you to have a default configuration file, when a single index.html should be enough.

Thought that gluing together a template system with some css pre-processing inside a CLI tool should do the trick. And it did.

License

MIT License

Copyright (c) 2018 Carlos Fernández

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.