https://github.com/rbren/bb-asset-manager
https://github.com/rbren/bb-asset-manager
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/rbren/bb-asset-manager
- Owner: rbren
- Created: 2015-09-30T01:13:22.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-06-09T16:47:46.000Z (about 10 years ago)
- Last Synced: 2025-02-10T07:15:26.151Z (over 1 year ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
npm install --save bb-asset-manager
```
## Basic Usage
```js
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
```html
```
## Advanced Usage
See [Advanced Usage](AdvancedUsage.md) 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