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

bb-asset-manager

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bb-asset-manager

A lightweight asset manager for Node

  • 2.2.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bb-asset-manager

Yet another asset manager for NodeJS.

This package allows you to declare a directory that will be served statically on your webserver. You can then package files in that directory together into concatenated and minified assets which can be easily included in your HTML. You can also easily switch between using raw and minified assets e.g. for easier debugging in development.

Installation

npm install --save bb-asset-manager

Basic Usage

  var AssetMan = require('bb-asset-manager');
  var assetMan = new AssetMan({
    staticDirectory: __dirname + '/static', // Where your static assets live
    outputDirectory: '/minified',           // Relative to staticDirectory
  });
  assetMan.addAsset('bootstrap', {
    js:  ['bower_components/bootstrap/bootstrap.js'],
    css: ['bower_components/bootstrap/bootstrap.css'],
  });

  assetMan.addAsset('home', {
    css: ['css/home.css'],
    dependencies: ['bootstrap'],
  })
  
  assetMan.compileSync();
  
  console.log(assetMan.renderAsset('home'))

Will output

<link rel="stylesheet" type="text/css" href="/minified/css/home.css">
<script type="text/javascript" src="/minified/js/home.js"></script>

Advanced Usage

See Advanced Usage for details on controlling minification, concatenation, and file ordering.

Contributions

Contributions are welcome! I'll try to respond to PRs within 24 hours.

TODO

  • Add a build process for e.g. ES6 and CoffeScript transpiling
  • Expose Express middleware for auto-recompiling in development

FAQs

Package last updated on 09 Jun 2016

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