https://github.com/remy/harp-static
Simple harp.js static server (for heroku, etc)
https://github.com/remy/harp-static
Last synced: 7 months ago
JSON representation
Simple harp.js static server (for heroku, etc)
- Host: GitHub
- URL: https://github.com/remy/harp-static
- Owner: remy
- Created: 2014-02-01T15:55:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-10-27T03:27:31.000Z (almost 10 years ago)
- Last Synced: 2025-03-19T01:59:27.568Z (7 months ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 13
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Harp Static
===========Simple Harp.js static server.
With Harp.js, if you want your source content files to work as a static
generated site, then you *must* refer to urls using `.html`.I don't like this.
So this script quite simply creates a static server (that caches assets), and
maps normal Harp urls (i.e. without an extension on `.html`) and maps them to
real files.Now you can use non-static for development, and static for live (deployed to
Heroku, etc).Example of usage (and in fact, how I'm using `harp-static`):
```js
'use strict';
var harp = require('harp');
var server = require('harp-static');
var outputPath = __dirname + '/www';
var port = process.env.PORT || 9000;harp.compile(__dirname, outputPath, function (errors){
if (errors) {
console.log(JSON.stringify(errors, null, 2));
process.exit(1);
}console.log('Running harp-static on ' + port);
server(outputPath, port);
});
```