0.46.1 • Published 2 years ago

harp v0.46.1

Weekly downloads
1,091
License
MIT
Repository
github
Last release
2 years ago

Harp

zero-configuration web server with built in pre-processing

What is Harp?

Harp is a static web server that also serves Jade, Markdown, EJS, Less, Stylus, Sass, and CoffeeScript as HTML, CSS, and JavaScript without any configuration. It supports the beloved layout/partial paradigm and it has flexible metadata and global objects for traversing the file system and injecting custom data into templates. Optionally, Harp can also compile your project down to static assets for hosting behind any valid HTTP server.

Why?

Pre-compilers are becoming extremely powerful and shipping front-ends as static assets has many upsides. It's simple, it's easy to maintain, it's low risk, easy to scale, and requires low cognitive overhead. I wanted a lightweight web server that was powerful enough for me to abandon web frameworks for dead simple front-end publishing.

Features

  • easy installation, easy to use
  • fast and lightweight
  • robust (clean urls, intelligent path redirects)
  • built in pre-processing
  • first-class layout and partial support
  • built in LRU caching in production mode
  • can export assets to HTML/CSS/JS
  • does not require a build steps or grunt task
  • fun to use

Supported Pre-Processors

Resources

Authored and maintained by @sintaxi.


Installation

sudo npm install -g harp

Quick Start

Start Harp server by pointing oit

mkdir ./public
harp  ./public

Your Harp application is now running at http://localhost:9000 You can now fill your project with ejs, jade, md, sass, scss files to be processed autmatically.

Compile your project...

harp ./public ./build

Yor dist folder is now ready to be published at a static host such as Surge.sh


Documentation

Harp can be used as a library or as a command line utility.

CLI Usage

 
  Harp 〜 Static Web Server v0.46.0

  USAGE
    harp <source>                                   serves project locally
    harp <source> <build>                           compiles for static host

  OPTIONS
    -p, --port                      9000            server port to listen on
    -h, --host                      0.0.0.0         server host to answer to
    -s, --silent                    false           supresses logs
    -h, --help                                      outputs this help message
    -v, --version                                   outputs version of harp

 ╭───────────────────────────────────────────────────────────────────────────────╮
 │                                                                               │
 │  PROCESSING                          DATA                                     │
 │    .ejs  ->  .html                     _data.json  -  directory data          │
 │    .jade ->  .html                     _data.js    -  dynamic build data      │
 │    .md   ->  .html                                                            │
 │    .sass ->  .css                    GENERATION                               │
 │    .scss ->  .css                      partial("_path/to/partial", {          │
 │    .cjs  ->  .js                         "title": "Hello World"               │
 │    .jsx  ->  .js                       })                                     │
 │                                                                               │
 ╰───────────────────────────────────────────────────────────────────────────────╯

Lib Usage

You may also use harp as a node library for compiling or running as a server.

Serve up a harp application...

var harp = require("harp")
harp.server(projectPath [,args])
server.listen(port, host)

Or compile harp application

var harp = require("harp")
harp.compile(projectPath [,outputPath] [, callback])

Or use as Connect/ExpressJS middleware

// Express
var express = require("express");
var harp = require("harp");
var app = express();

app.use(express.static(__dirname + "/public"));
app.use(harp.mount(__dirname + "/public"));

app.listen(port, host)

License

Copyright © 2012–2021 Chloi Inc. All rights reserved.

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.

0.46.1

2 years ago

0.43.0

2 years ago

0.44.0

2 years ago

0.45.0

2 years ago

0.46.0

2 years ago

0.42.0

2 years ago

0.41.2

3 years ago

0.40.2

4 years ago

0.40.3

4 years ago

0.40.0

4 years ago

0.40.1

4 years ago

0.41.0

3 years ago

0.34.0

4 years ago

0.33.0

4 years ago

0.32.0

5 years ago

0.31.0

5 years ago

0.30.1

5 years ago

0.30.0

6 years ago

0.29.0

6 years ago

0.28.1

6 years ago

0.28.0

6 years ago

0.27.0

6 years ago

0.26.0

7 years ago

0.25.0

7 years ago

0.24.1

7 years ago

0.24.0

8 years ago

0.23.0

8 years ago

0.22.0

8 years ago

0.21.0

8 years ago

0.21.0-pre.1

8 years ago

0.21.0-pre.0

8 years ago

0.20.3

9 years ago

0.20.2

9 years ago

0.20.1

9 years ago

0.20.0

9 years ago

0.19.0

9 years ago

0.18.0

9 years ago

0.17.0

10 years ago

0.16.0

10 years ago

0.15.2

10 years ago

0.15.1

10 years ago

0.15.0

10 years ago

0.14.0

10 years ago

0.13.0

10 years ago

0.12.1

11 years ago

0.12.0

11 years ago

0.11.2

11 years ago

0.11.1

11 years ago

0.11.0

11 years ago

0.10.2

11 years ago

0.10.1

11 years ago

0.10.0

11 years ago

0.9.5

11 years ago

0.9.4

11 years ago

0.9.3

11 years ago

0.9.2

11 years ago

0.9.1

11 years ago

0.9.0

11 years ago

0.8.13

11 years ago

0.8.12

11 years ago

0.8.11

11 years ago

0.8.10

11 years ago

0.8.9

11 years ago

0.8.8

11 years ago

0.8.7

11 years ago

0.8.6

11 years ago

0.8.5

11 years ago

0.8.4

11 years ago

0.8.3

11 years ago

0.8.2

11 years ago

0.8.1

11 years ago

0.8.0

11 years ago

0.7.10

11 years ago

0.7.9

11 years ago

0.7.8

11 years ago

0.7.7

12 years ago

0.7.6

12 years ago

0.7.5

12 years ago

0.7.4

12 years ago

0.7.3

12 years ago

0.7.2

12 years ago

0.7.1

12 years ago

0.7.0

12 years ago

0.6.2

12 years ago

0.6.1

12 years ago

0.6.0

12 years ago

0.5.6

12 years ago

0.5.5

12 years ago

0.5.4

12 years ago

0.5.3

12 years ago

0.5.2

12 years ago

0.5.1

12 years ago

0.5.0

12 years ago

0.4.5

12 years ago

0.4.4

12 years ago

0.4.3

12 years ago

0.4.2

12 years ago

0.4.1

12 years ago

0.4.0

12 years ago

0.3.6

12 years ago

0.3.5

12 years ago

0.3.4

12 years ago

0.3.3

12 years ago

0.3.2

12 years ago

0.3.1

12 years ago

0.3.0

12 years ago

0.2.6

12 years ago

0.2.5

12 years ago

0.2.4

12 years ago

0.2.3

12 years ago

0.2.2

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.0

12 years ago