Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ben-ng/velociraptor
Asset management for Node.js
https://github.com/ben-ng/velociraptor
Last synced: 21 days ago
JSON representation
Asset management for Node.js
- Host: GitHub
- URL: https://github.com/ben-ng/velociraptor
- Owner: ben-ng
- Created: 2013-05-17T23:52:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-16T05:11:03.000Z (over 11 years ago)
- Last Synced: 2024-10-14T06:44:42.882Z (25 days ago)
- Language: JavaScript
- Size: 527 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Velociraptor
Node.js asset compiler that supports JavaScript, Handlebars, CSS and LESS.
##What It Does
Velociraptor will compile assets in a `source` directory and dump them into an `output` directory.1. Velociraptor will first build the bundles defined in `source/bundles.json`
2. Any files in `source` that were not part of a bundle will be copied to `output`
1. **Important:** `.less` files will not be copied as part of this step as they are expected to be part of a bundle.##bundles.json example
```json
{
"css/styles.css":[
"less/bootstrap.less",
"less/style.less",
"less/responsive.less"
],
"js/scripts.js":[
"js/jquery.js",
"js/bootstrap.js",
"js/core/core.js",
{
"dir": "templates",
"type": "handlebars"
},
"js/config/init.js"
]
}```
###Handlebars
To precompile, put your templates in a directory and Velociraptor will recursively discover your templates. Note the special syntax in `bundles.json` -- you must define a directory, not the individual files.##Command-line Usage
```bash
# Compile from ./assets to ./tmp
# without minification
velociraptor ./assets ./tmp# Compiling: /somepath/assets
# into: /somepath/tmp
# without minification
# Compiled 2 bundles from 7 sources
# Copied 4# Compiling with minification
velociraptor -m ./assets ./tmp
```##Programmatic Usage
```js
var Velociraptor = require('velociraptor');//No minification
Velociraptor.compile(source, target, function(err, results) {
if(err) {
console.log("Error: "+err);
}
else {
console.log(results);
// e.g.
// {
// bundles: 2
// , bundlesources: 7
// , minified: false
// , copied: 5
// }
}
});//Minification
Velociraptor.compile(source, target, {minify:true}, function(err, results) {
//etc...
});
```