• Stars
    star
    4,995
  • Rank 8,325 (Top 0.2 %)
  • Language
    JavaScript
  • Created almost 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Static Web Server/Generator/Bundler

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.

More Repositories

1

surge

CLI for the surge.sh CDN
JavaScript
2,861
star
2

phonegap

access core functions on Android, iPhone and Blackberry using JavaScript
JavaScript
2,104
star
3

dbox

NodeJS SDK for Dropbox API (THIS LIBRARY IS OBSOLETE!!)
JavaScript
513
star
4

terraform

Asset pipeline for the Harp Web Server.
JavaScript
102
star
5

learn-ruby

files for learning ruby. quickly.
Ruby
79
star
6

nhl

a screen scraping nhl.com api (this project was created as a demonstration)
JavaScript
70
star
7

rolodex

Node user management system using redis
JavaScript
42
star
8

phonegap-examples

open source phonegap examples go here
JavaScript
33
star
9

thug

ORM replacement that provides a functional style object filtration and validation system.
JavaScript
20
star
10

pmpknpi

A RESTful Blog API written in Merb
JavaScript
19
star
11

node-redis-tag

Node tag system using redis.
JavaScript
18
star
12

waterfront

A generic message broker system on top of ZeroMQ with discovery patterns for push/pull, req/rep, pub/sub.
JavaScript
18
star
13

git-harvest

github hook for posting time to harvest
Ruby
16
star
14

node-redis-authorization

Node authorization system built on redis.
JavaScript
12
star
15

phonegap-docs

hand written docs for phonegap and xui
JavaScript
11
star
16

statuscodedrinkinggame

drinking game API built on Smart Platform
JavaScript
8
star
17

smart-messagepub

send AIM, Google Chat, Email, Twitter, Phone, and SMS on the smart platform.
JavaScript
7
star
18

hb-browserify

a boilerplate project for using harp with browserify.
HTML
7
star
19

alluvium

time-series analytics for static web sites.
JavaScript
6
star
20

pressman

email templating system
JavaScript
6
star
21

merb_can_filter

merb plugin for filtering Markdown or Textile to HTML (also does syntax highlighting via coderay).
Ruby
5
star
22

gambit

A minimal mobile UX navigation library for html5 mobile web and cordova applications.
JavaScript
5
star
23

yonder

Redirects for front-end applications. Works on surge.sh.
JavaScript
5
star
24

very-old-phonegap-and-xuijs-websites

stumbled on this old repo late one night. decided to publish it.
JavaScript
5
star
25

refuze

A natural language job queue for doing things later. Built on Redis.
JavaScript
5
star
26

exhale

expiring token system for ephemeral tasks such as email verification and password reset
JavaScript
5
star
27

microplatform

JavaScript
4
star
28

smart-helpers

layout, form, and date helpers for Joyent Smart Platform
JavaScript
4
star
29

yoke

preprocessor for language agnostic concatenation
JavaScript
4
star
30

merb_bot_test

Quick and dirty spam protection using a math equation.
Ruby
3
star
31

merbums

Merb powered forum inspired by Beast
Ruby
3
star
32

nwo

another web publishing tool by sintaxi
JavaScript
3
star
33

aria

A client library for Aria API
JavaScript
3
star
34

hb-minimal

A minimal boilerplate for the Harp Application
3
star
35

urlinfo-server

a service for providing information on any given url
JavaScript
3
star
36

ru

dunno what this is
JavaScript
2
star
37

smart-platform

Joyent Smart Platform
Perl
2
star
38

node-timerange

returns start and end timestamps for YYYY-MM-DD, YYYY-MM, or YYYY
JavaScript
2
star
39

sintaxi.github.com

github can blog
JavaScript
2
star
40

start

CSS
2
star
41

surge-sdk

JavaScript SDK used by Surge.sh CLI
JavaScript
2
star
42

pwa

JavaScript
2
star
43

harp-boilerplates

CLI for searching the Harp Boilerplates registry.
JavaScript
1
star
44

vanjs.no.de

chat example using redis, socket.io, express
JavaScript
1
star
45

nhl-client

CSS
1
star
46

virtual-dom-starter

bare-bones virtual-dom starter using main-loop and browserify/watchify with npm run scripts
JavaScript
1
star
47

localci

test runner for front-end web projects
1
star
48

popp

command line tool to pluck the first line out of file
JavaScript
1
star
49

foxy

a simple proxy middle for CORS
JavaScript
1
star
50

cldflr

static publishing to surge.sh fronted by cloudflare
JavaScript
1
star
51

roller

an example on how to use rolodex
JavaScript
1
star