Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-manifest-helpers

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-manifest-helpers

View helpers to use with an asset manifest

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
506
decreased by-59.26%
Maintainers
1
Weekly downloads
 
Created
Source

Express Manifest Helpers

Circle CI

Use as express middleware to provide view helpers methods

Install

$ npm install express-manifest-helpers

Example Usage

import express from 'express'
import manifestHelpers from 'express-manifest-helpers'

var app = express()

app.use(manifestHelpers({
  manifestPath: '/path/to/manifest.json'
}))

doctype html
html(lang="en")
  head
    title Page Title
    != stylesheetTag('style.css')

  body
    != imageTag('logo.png')

    != javascriptTag('app.js')

Helpers can also output html attrs

!= imageTag('logo.png', { width: 120, height: 120 })
// <img src="logo.png" width="120" height="120" />

Disable the cache for development

app.use(manifestHelpers({
  manifestPath: '/path/to/manifest.json',
  cache: process.env.NODE_ENV === 'production'
}))

Prepend a path to the asset urls

app.use(manifestHelpers({
  manifestPath: '/path/to/manifest.json',
  prependPath: '//cdn.example/assets'
}))

Helpers

assetPath(source) - returns the path to the provided source

imageTag(source, attrs) - return a img tag for the source provided

javascriptTag(source, attrs) - return a script tag for the source provided

stylesheetTag(source, attrs) - return a link tag for the source provided

getManifest() - returns the original manifest file for convenience

getSources() - returns a list of sources from the manifest

getStylesheetSources() - returns a list of all sources ending with .css

getStylesheets() - returns a list of all stylesheets and their resolved paths

getJavascriptSources() - returns a list of all sources ending with .js

getJavascripts() - returns a list of all javascripts and their resolved paths

getImageSources() - returns a list of all sources ending with .jpg, .jpeg, .gif, .png, .bmp or .webp,

getImages() - returns a list of all images and their resolved paths

Keywords

FAQs

Package last updated on 05 Apr 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