Socket
Socket
Sign inDemoInstall

bb-asset-manager

Package Overview
Dependencies
22
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bb-asset-manager

A lightweight asset manager for Node


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Install size
2.86 MB
Created
Weekly downloads
 

Readme

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

Last updated on 09 Jun 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc