New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

common-middleware-fix

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-middleware-fix

Common middleware for applications built with base-methods (like assemble, verb, generate, and update)

  • 1.0.2-0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

common-middleware NPM version NPM monthly downloads NPM total downloads Linux Build Status

Common middleware for applications built with base-methods (like assemble, verb, generate, and update)

Install

Install with npm:

$ npm install --save common-middleware

Usage

var middleware = require('common-middleware');
var assemble = require('assemble-core');

// create your app
var app = assemble();

// register the middleware
app.use(middleware());

Middleware

The following middleware are included.

front matter

Parses front-matter on files that match options.extRegex and adds the resulting data object to file.data. This object is passed as context to the template engine at render time.

unescape templates

Registers a .preWrite middleware for unescaping escaped delimiters.

escape templates

Uses C-style macros to escape templates with {%%= foo %} or <%= foo %> syntax, so they will not be evaluated by a template engine when .render is called.

JSON on-load

Adds a json property to the file object when the file extension matches options.jsonRegex. This allows JSON files to be updated by other middleware or pipeline plugins without having to parse and stringify with each modification.

JSON pre-write

If file.contents has not already been updated directly, the file.contents property is updated with stringified JSON before writing the file back to the file system.

Options

options.jsonRegex

Customize the regex used for matching JSON files.

Example

app.use(middleware({jsonRegex: /\.json$/}));

options.extRegex

Customize the regex used for matching template file extensions.

Example

app.use(middleware({jsonRegex: /\.(hbs|tmpl)$/}));

options.escapeRegex

Customize the regex used for matching the extensions of files with templates to escape.

Example

app.use(middleware({jsonRegex: /\.(tmpl|hbs)$/}));

About

  • assemble-core: The core assemble application with no presets or defaults. All configuration is left to the… more | homepage
  • base: Framework for rapidly creating high quality node.js applications, using plugins like building blocks | homepage
  • generate: Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… more | homepage
  • update: Be scalable! Update is a new, open source developer framework and CLI for automating updates… more | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on July 16, 2017.

Keywords

FAQs

Package last updated on 30 Aug 2018

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