harp

Static Site Server/Generator with built-in preprocessing

  • 所有者: sintaxi/harp
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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, Language Superset, Whitespace Sensitive, ---------------, -----------------------------------------------------------------, --------------------------------------------------------------------------------------, HTML, EJS, Jade, Markdown, CSS, LESS, Sass (SCSS), Stylus, Sass, JavaScript, (TBD), CoffeeScript

Resources

Authored and maintained by @sintaxi. Made for the @HarpPlatform.


Installation

sudo npm install -g harp

Quick Start

Creating a new harp application is a breeze...

harp init myproj
harp server myproj

Your Harp application is now running at http://localhost:9000


Documentation

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

CLI Usage

Usage: harp [command] [options]

Commands:

  init [path]                 initalize new harp application (defaults to current directory)
  server [path] [options]     start harp server
  compile [path] [options]    compile project to static assets
  multihost [path] [options]  start harp server to host directory of harp apps

Options:

  -h, --help     output usage information
  -V, --version  output the version number

Start the server in root of your application by running...

harp server

You may optionally supply a port to listen on...

harp server --port 8002

Compile an application from the root of your application by running...

harp compile

You may optionally pass in a path to where you want the compiled assets to go...

harp compile --output /path/to/cordova/project/www

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] [,callback])

Or compile harp application

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

Or use as Connect/ExpressJS middleware

var express = require("express");
var harp = require("harp");
var app = express();
// Express 3
app.configure(function(){ 
  app.use(express.static(__dirname + "/public"));
  app.use(harp.mount(__dirname + "/public"));
});
// Express 4

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

License

Copyright © 2012–2014 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.

主要指標

概覽
名稱與所有者sintaxi/harp
主編程語言JavaScript
編程語言JavaScript (語言數: 10)
平台
許可證
所有者活动
創建於2012-12-03 02:49:07
推送於2023-01-13 10:48:35
最后一次提交2023-01-13 02:46:51
發布數104
最新版本名稱v0.46.1 (發布於 2023-01-13 02:47:23)
第一版名稱v0.1.0 (發布於 2012-12-02 18:50:32)
用户参与
星數5k
關注者數108
派生數341
提交數703
已啟用問題?
問題數557
打開的問題數27
拉請求數65
打開的拉請求數18
關閉的拉請求數30
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?