Socket
Socket
Sign inDemoInstall

servebar

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

servebar

Local handlebars web page serving


Version published
Weekly downloads
9
increased by200%
Maintainers
0
Weekly downloads
 
Created
Source

servebar

npm version

servebar is a server of static files with support for Handlebars templates.

All files with the .hbs extension are served as static HTML using Handlebars. All other files are served as-is.

Installation

To install servebar, run the following command:

npm install -g servebar

Usage

Run the following command in the directory you want to serve:

servebar

Options

Running servebar in a directory will serve the files in that directory, without further modification. Handlebars templates are rendered, and partials are included from the partials directory, but all variables are empty, and no helpers are included.

To customize the behavior of servebar, you can create a servebar directory in the directory you want to serve. In this directory, you can create the following files:

  • data.json: A JSON file with the data to be used in the Handlebars templates.
  • *.js: Any JavaScript file that exports a function is mounted as a Handlebars helper. The name of the function is used as the name of the helper.

Example of data.json

{
  "title": "My Website",
  "description": "This is my website."
}

Example of a helper

const translate = (key) => {
    return `translate("${key}")`;
};

module.exports = translate;

Keywords

FAQs

Package last updated on 01 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc