Code Monkey home page Code Monkey logo

hyper-static's Introduction

Hyper-Static

A bare-bones static site generator using Hyperscript, Marked and PostCSS.

This is not a library or framework, it's a starter project that you can use as a base and customize for the site you're building. It's meant to be simple and transparent so that it's easy to change anything.

Install

npm install

Usage

scripts/build.js is the top-level script that orchestrates page generation. You can change this code to do whatever you want. You can use this npm script to invoke it:

npm run build

The src directory is intended to contain all sources for files that are generated:

  • html (in the form of Hyperscript in .js files)
  • markdown (in .md files) as content for html files
  • css (PostCSS in .pcss files)

Organize them however you like.

Note that Javascript (or Typescript, etc.) compilation/bundling was considered too complex and opinionated so I leave that to you if you need it.

Source files will be compiled and output to the public directory.

Handling static files

There are a couple of ways to handle static files (such as images, PDFs, media files, etc.) that are not generated or processed during the build.

One is to store them in the public directory. Images are the most obvious candidate, but you might wish to add fonts, media files, and so on. You'll need to edit the .gitignore file if you want to include additional directories or files under public in the git repo, and you'll have to take care that the npm clean script is kept up to date.

Alternately you might prefer to have a build script that outputs the entire site from scratch by copying all static files from src to public. This reduces the complexity of clean scripts and the .gitignore file. Choose whichever approach suits your project best.

Develop

npm start

This will compile the pages and styles and serve them through a local server at http://localhost:3000. The compiled CSS bundle will contain source maps for your .pcss sources. The browser will auto-refresh whenever layout, content or css changes are made to the sources.

hyper-static's People

Contributors

spacejack avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.