Coder Social home page Coder Social logo

monobase's Introduction

Monobase

A fast and simple React static site generator that let's you build a site from a set of components.

Quick start

  • Download the default project template
  • cd ~/Downloads/project
  • make serve to start you dev server
  • make build to generate your site

Why is it great?

Monobase let's you build sites in a component based way, allowing you to isolate and re-use every part of your website. Don't build a site, build a site system.

More great features:

  • Components can be optionally be interactive (if marked dynamic).
  • Style and correctness enforcing through TypeScript and Prettier.
  • Automatic browser reloading on changes.
  • Fast with even huge sites through incremental rendering.
  • Easily extendable with existing React components.
  • Extra fast reloading on css only file changes [todo].
  • Automatic port selection if default is taken.
  • Secure SSL serving by default.
  • Nicely formatted terminal logging.
  • Extensive error page with hints for common issues.

Project layout

  • /Makefile Shorthands for commands to quickly build or install.
  • /pages The html pages including site structure.
  • /pages/index.ts Default index page.
  • /pages/404.ts File not found page.
  • /components The React Components used by the pages.
  • /components/template.ts Default page template.
  • /static Just static files like css, images, fonts and downloads.

Dynamic components

Some React components are interactive. Monobase generates a single script called components.js containing every marked component and hydrates them after the page load so they become interactive. This means the inital html gets loaded statically, and then code attaches itself automatically after page load.

To mark components as interactive:

  • Wrap them in the Dynamic component [example]
  • Export them in /components/dynamic.ts [example]

Example dynamic components

You can find these in the default project /components folder.

  • Button – Just a button you can click.
  • Timer - A timer that displays the running time in ms.
  • Cookie - An input that stores values in a cookie. [todo]
  • Scroll – An element that responds to page scrolling. [todo]
  • Mouse – A mouse location display.
  • RandomImage - An unsplash random image element.

Todo

  • Make project based (non relative) path loading work.
  • Improve dynamic component discovery (automagically, tips welcome).

monobase's People

Contributors

koenbok avatar

Watchers

Simon Evans 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.