lhassa

0.1.5 • Public • Published

#1. LhassaJS

##1.1. What is it ?

Lhassa is a small and simple static site framework written in NodeJS, based upon ExpressJS framework, EJS template engine and Markdown.

##1.2. Why ?

Because I need such a simple framework for some clients of mine, and I feel comfortable writing simple front-end applications using such a tool.

AND... I actually HATE using bloated things...

##1.3. How do I use it ?

In your project :

npm install --save lhassa

then in your main project file (app.js, server.js, index.js or whatever...) :

appdir = __dirname; // define application directory
lhassa = require('lhassa'); // require Lhassa from local packages
app = lhassa(__appdir); // instanciate Lhassa application (it's an ExpressJS app)
app.listen(3000); // listen on port 3000

As lhassa(...) returns an ExpressJS application, you can use it as a sub-application...

##1.4. Is there any API ?

Lhassa is meant to be simple, easy and clean, no API is provided at the moment, because it doesn't need any !

##1.5. Lhassa assumes some files exist...

src/ - layouts, pages and posts

src/includes/*.ejs - things you do not want to repeat, do not forget : 'DRY is mandatory for great code !'

src/errors/404.ejs - your 'error 404' page
src/errors/500.ejs - your 'OMG something went totally wrong and my site is broken !' page

src/pages/*.ejs - all your static pages
src/posts/*.md - all your posts written in markdown


pub/ - public static files, compiled assets, etc...


site.json - your site / subapp configuration

#2. site.json

Here is a basic site.json example :

{
  "lang" : "fr"
  "title" : "my awesome site"
  "pages" : {
  	"/" : { "src" : "index", "title" : "Hello World !" }
  },
  "posts" : [ "hello.md", "bad_news.md", "hi_there.md" ]
}

lang (String) : fr|en|... - html lang="" property

title (String) : default title tag property

pages (Object) : url -> object pairs, each url is associated with a source file (in src/pages/) and a title. You can add properties.

posts (Array) : ordered array of posts from past to present (newest is last in the array, oldest is first)

Readme

Keywords

Package Sidebar

Install

npm i lhassa

Weekly Downloads

0

Version

0.1.5

License

BSD-2-Clause

Last publish

Collaborators

  • ptellier