{"_id":"convoy","_rev":"21-c32de25e6418cdb9b6f5e21e3089541e","name":"convoy","description":"Pluggable, package-aware asset pipeline for node","dist-tags":{"latest":"0.4.1"},"versions":{"0.1.0":{"name":"convoy","version":"0.1.0","author":{"name":"Charles Jolley"},"description":"Pluggable, package-aware asset pipeline for node","dependencies":{"async":"latest","resolve":"latest","uglify-js":"latest"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.1.0","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"07d10628b9bb3df0077f1302fb57548a5b885266","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.1.0.tgz","integrity":"sha512-3uqYAF9fiZ6ieNAUjWhF9oSQoksO08bKT7M1Uvc14sUucEMIhViNNIIdlhYvDYyafV5cm7EWAOxobWd7aHswHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5uamA9wSgnoG0BH9+5HCo1rsJ78F6L8YlBgfoaI8goAIhAI9MjhdsjSqETw49yqk4scZFvLuY9zuH/+ElYfVfhkq5"}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.1.1":{"name":"convoy","version":"0.1.1","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/charlesjolley/convoy","bugs":{"url":"http://github.com/charlesjolley/convoy/issues"},"repository":{"type":"git","url":"git://github.com/charlesjolley/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","resolve":"0.2.x","uglify-js":"~1.2"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.1.1","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"9921b00ab4dc49184a4fcc143ba7c66bb5e2ee6d","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.1.1.tgz","integrity":"sha512-iWEEOotMTsyDVzvWm24Ez/pdB19E7EBr7pKjbqHQsI19XSoNQTYZUTAkIf4xFF5tsoTdcIVOM9VX8Vl6c/sMRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrqjEnfeo0G2tggEFyZQLcdEgSkxCx6NwzCAMDXSK+KAIhAID7n5u3Kjgh0anRjKyI2y0uPAOuYyqKHb06X3YHQ8i1"}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.1.2":{"name":"convoy","version":"0.1.2","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"git://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","resolve":"0.2.x","uglify-js":"~1.2"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.1.2","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"39b243b1d835d4b0bc90d51fddfd88d0a6c8a785","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.1.2.tgz","integrity":"sha512-j/UciPFXE3Ai7drRL983NN398tCJITxJD319cfiwyhoO3ICrH/BCbhdsPawLr0ouQaS53rohQ5RoYCJtczSrgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1hyXcy0uqDN1RXXVMqsK3e1+Ps14HSk02UIuZIFEl6QIgVm841gjTQZq67XOLJJ2v/RzfpsqwVqSZufuD2NvdreE="}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.2.0":{"name":"convoy","version":"0.2.0","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"git://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","resolve":"0.2.x","uglify-js":"~1.2","glob":"~3.1","mime":"~1.2","watch":"0.5.x","coffee-script":"~1.3"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.2.0","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"50a2aa4fcf66c8e85145369edb61b8fa0c893706","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.2.0.tgz","integrity":"sha512-X0eCEysEq7CB1+NVxO7VeKtjgXwdi25ri/K8iUv8AImIcQLSfwo94I52IKhbEKgQbn/xr369BVwru4+H7xIGrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDsJGl5+DYTom/ZhyzYrZi5zT3W3RPpAyXhIWRl+kxxfAiBNVBGZaWd77/zADp5E4MGG88VY/nHn1AI7UwRp96gnLw=="}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.3.0":{"name":"convoy","version":"0.3.0","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"git://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","uglify-js":"~1.2","glob":"~3.1","mime":"~1.2","coffee-script":"~1.3"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest","connect":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.3.0","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.16","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"0112436a556a9be495c7dcb7f77588dec3750fa8","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.3.0.tgz","integrity":"sha512-FQ9JRirqOF2t0PSBW6aTkmRDpss4Dv2MZ1tFeXrcUXdew0k1LeP/d/VqjS56kWUDEjL/UZRamLzV3eNwvM4OfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHE+XPAtkhQm94p9PLSidailQYF4FgAMpIKcFpo/zGYhAiBc64GVeB8KGzCtfPwJ/1kahwLC4AWWrcr2+gZy70/dTg=="}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.3.1":{"name":"convoy","version":"0.3.1","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"git://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","uglify-js":"~1.2","glob":"~3.1","mime":"~1.2","coffee-script":"~1.3","connect":"~2.2","commander":"~0.5"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"bin":{"convoy":"./bin/convoy"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.3.1","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.19","_nodeVersion":"v0.6.16","_defaultsLoaded":true,"dist":{"shasum":"ca25366bfc006abf2652ab7c524763e3b05948e8","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.3.1.tgz","integrity":"sha512-vIWLZing/ABbF5C6sDVLnsOivSEgw7KZ6c62scIZyNui3ZWyy+niK5LlKvhtL7ku2panDLhHAgakWxLrCvdUWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDmThfOs4XKgZq2sMBRsJ8dM4pvCyGq1tachNRX413KoAiEAhVx2xq7JSpOYAa5QpR85ljvMhHQgIyHFka5Pb3VmBUk="}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.3.2":{"name":"convoy","version":"0.3.2","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"git://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","uglify-js":"~1.2","glob":"~3.1","mime":"~1.2","coffee-script":"~1.3","connect":"~2.2","commander":"~0.5"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"bin":{"convoy":"./bin/convoy"},"_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"_id":"convoy@0.3.2","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.19","_nodeVersion":"v0.6.16","_defaultsLoaded":true,"dist":{"shasum":"b85a64bc63d367aaba6c70116943fd4f75774405","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.3.2.tgz","integrity":"sha512-hGgI3kRGCl0ZRn/EdAJ1z+f/eoFOobn6xLk10QDErfBaHG18HOgg1yeKkY/AXB/6qyjSuPoH/Q+MihI5yacqwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIElfAi11RZe6wMK4X/XLGfWCm2lmKWAFRLGQW36Z5BWGAiEAswqV32JiL6kjfGy5o5MyQuIeUEBIijy16NkS7Syxt5U="}]},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.4.0":{"name":"convoy","version":"0.4.0","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"http://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","uglify-js":"~1.2","uglifycss":"~0.0.5","glob":"~3.1","mime":"~1.2","coffee-script":"~1.3","connect":"~2.2","commander":"~0.5"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"bin":{"convoy":"./bin/convoy"},"readme":"# Convoy\n\nConvoy is a package-aware, pluggable asset pipeline for node applications. You\ncan use it to generate static assets either as a part of a live server or via \na build tool chain.\n\n## Using Shared Libraries In Static Assets\n\nBecause Convoy is package-aware, you can include modules, CSS, and other assets\nfrom packages you install from npm or other sources. Including assets in your\nbuild couldn't be easier - just `require()` them!\n\nFor example, to include the popular `async` library in your client side app, \njust add it to your dependencies in you package json and then in your _client\nside_ javascript:\n\n    var async = require('async');\n\nThat's all you have to do! When you build your assets, convoy will notice this\nrequire() and automatically pull in the async module assets.\n\nConvoy technically can include JavaScript from any NPM package. However, the \ncode itself must not use any node-specific APIs since they will not be \navailable in the browser.\n\nIn addition to JavaScript, packages can also include CSS and legacy (i.e. \nnon-CommonJS module-based) JavaScript. See the section on \"CSS and Legacy\nJavaScript\" below for more info.\n\n## Using Convoy\n\nTo use convoy, you must integrate it into your server code or build scripts.\nYou can find some examples of how to do this in the examples directory. \n\nGenerally, creating a convoy pipeline is simple. Just invoke the convoy \nfunction and pass a config defining your assets:\n\n    var convoy = require('convoy');\n    var path   = require('path);\n\n    // create a new pipeline with an app.js and app.css file.\n    var pipeline = convoy({\n      'app.js': {\n        packager: 'javascript',  // selects some default plugins\n        main:  path.resolve('app/main.js'), // starting module to include\n        minify: true // must be set to minify output\n      },\n\n      'app.css': {\n        packager: 'css',\n        main: path.resolve('app/styles') // includes app/styles/index.css\n      },\n\n      'assets': {\n        packager: 'copy',\n        root: 'app/assets'\n      }\n    });\n\nThe pipeline above will know who to generate two assets:\n\n    * `app.js` will include the module found at `'app/main.js'` plus any \n      modules (in any package) required by the module.\n    * `app.css` will include the module found at `'app/styles/index.css`' plus\n      any css files (in any package) required by that file.\n\nIt will also be able to copy any assets found in the `'app/assets'` directory.\nThey will be available under the `assets` directory in the built output.\n\nOnce you have created a pipeline, you can either build the assets into memory\nor write them to a file on disk. You will generally want to just build the \nassets if you are using the pipeline in a server and write to disk if you are\nusing the pipeline in a build script.\n\nWhen using Convoy with a server you will want to use the `exists()` and \n`build()` methods:\n\n    // returns true if the passed path matches a file in the pipeline, \n    // including an asset found in the copy task.\n    pipeline.exists('app.js', function(exists) {\n      // handle ..\n    });\n\n    // builds app.js, returning a hash with the body and other attributes for\n    // streaming to a server.\n    pipeline.build('app.js', function(err, asset) {\n      if (err) handle_error(err);\n      return_asset(asset.body);\n    });\n\nWhen using Convoy as part of a build task, you will want to use the \n`writeFile()` and `writeAllFiles()` tasks:\n\n    // writes app.js to the build directory `public`. Invokes callback when \n    // completed.\n    pipeline.writeFile('app.js', path.resolve('public'), function(err) {\n      if (err) handle_error(err);\n      // go to next step..\n    });\n\n    // writes ALL files known to the asset pipeline to disk.\n    pipeline.writeAllFiles(path.resolve('public'), function(err) {\n      if (err) handle_error(err);\n      // go to next step\n    });\n\nEventually I would like to include some rebuilt tasks and a connect middleware\n(already stubbed in at pipeline.js). Patches welcome if you would find these\nuseful.\n\n## CSS and Legacy JavaScript\n\nIn addition to modular JavaScript, Convoy also supports building CSS and \nlegacy JavaScript files. Since neither of these types of assets support the \n`require()` function, Convoy instead looks for require comments similar to the\nones defined by the Rails Pipeline. Here is how you can make a CSS file that\nincludes two other CSS files before it:\n\n    /* index css */\n    /*= require ./reset.css */\n    /*= require ./type.css */\n    /*= require bootstrap/styles */\n\nThis example file would include `reset.css` and `type.css` stylesheets before\nthe current one as well as any stylesheets found in the mythical `bootstrap`\npackage installed via npm.\n\nLegacy JavaScript files work the same way. To build an asset with legacy \njavascript instead of modules, use the `legacy_javascript` packager when \nconfiguring your pipeline:\n\n    pipeline = convoy({\n      'legacy.js': {\n        packager: 'legacy_javascript',\n        main: 'vendor/index.js'\n      }\n    });\n\nThis will select a set of default plugins that will just merge the JavaScript\ninstead of packing it in CommonJS modules.\n\n\n## Plugins - Building Other Asset Types\n\nIf Convoy doesn't handle all the file types you want or behave in exactly the\nright way for you, it is incredibly easy to customize it via plugins.\n\nWhen Convoy builds an asset, it passes the asset through several different\nstages, each driven by a separate plugin. Plugins all have\nthe same interface. They are just functions with the following signature:\n\n    function ConvoyPlugin(asset, context, done) {\n\n    }\n\nThe `asset` parameter is an object that describes the current asset. In general\nyour plugin will read and modify properties on this object.\n\nThe `context` parameter as an object that contains some utility functions as \nwell as the config settings you passed to the `convoy()` function when you\nsetup the pipeline.\n\nThe `done` parameter is a callback you should invoke (with an optional error)\nwhen your plugin is finished with its work.\n\nThere are seven different types of plugins, called in order when you build an\nasset:\n\n  1.  **compile** - called once for each input file. This plugin should load\n      the file contents into the `body` property on the asset. Implement a \n      compiler if you want to add support for another language like CoffeeScript\n      or LESS.\n\n  2.  **preprocessors** - an array of optional plugins, these are called on\n      each input file just after compile. This allows you to do global \n      manipulation on the file. For example you might remove asserts, etc.\n\n  3.  **analyzer** - called once for each input file to extract dependency\n      and module information. This is the plugin you would write if you want\n      some new way to extract dependencies. (such as using the `@import` tag\n      in LESS).\n\n  4.  **linker** - merges all the input files into a single asset. The passed\n      asset will have an `assets` property that is an ordered array of assets\n      to merge. The linker should generate a new body and set it to the `body`\n      property. Implement a linker if you want to control how assets are \n      merged. CommonJSLinker, for example, wraps modules and adds a default\n      loader.\n\n  5.  **postprocessors** - optional array of plugins, these are called on\n      the merged asset just after it is linked but before it is minified. You\n      might do extra code stripping, etc.\n\n  6.  **minifier** - if the `minify` config is set to true, this plugin will be\n      called to minify the merged asset. Implement if you want to define your\n      own minifier.\n\n  7.  **finalizers** - optional array of plugins called after minification.\n      Implement to add final markup such as copyright statements.\n\n## Using Plugins\n\nTo configure your own plugins, you just set them in your pipeline config. You\ncan also make module ids, in which case the exports of the module must be \nthe plugin function:\n\n    // add a custom finalizer to add a copyright statement and setup plugins \n    // to compile LESS with the (currently) fictional `convoy-less` package.\n\n    var COPYRIGHT = '// copyright 2012 MyCompany, Inc.\\n\\n';\n    function CopyrightFinalizer(asset, context, done) {\n      asset.body = COPYRIGHT + asset.body;\n      done();\n    }\n\n    var pipeline = convoy({\n\n      'app.js': {\n        packager: 'javascript',\n        main: path.resolve('app/main.js'),\n\n        finalizers: [CopyrightFinalizer]\n      },\n\n      'app.css': {\n        packager: 'css',\n        main: path.resolve('app/assets/main.less'),\n\n        compilers: {\n          '.less': 'convoy-less/pipeline_plugins/less_compiler'\n        },\n        minifier: 'convoy-less/pipeline_plugins/css_minifier'\n      }\n    });\n\n## Hacking/Contributing\n\nIf you'd like to make some changes to Convoy, just \n[fork it on github](http://github.com/charlesjolley/convoy), make your change, \nadd a unit test, and send me a pull request.\n\nTo run unit tests first run `npm install` on the project to add dependencies\nand then run `make test`.\n\n## Asking Questions\n\n[StackOverflow](http://stackoverflow.com/questions/tagged/convoy)\n\n## TODO\n\nThere are lots of things still to do. See TODOS.txt and Github Issues for some.\n\n## Copyright/License\n\ncopyright 2012 Charles Jolley and contributors\nMIT License.\n\n\n\n","_id":"convoy@0.4.0","dist":{"shasum":"2e0543f5dab2ee89176bf99bcd2225988106a606","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.4.0.tgz","integrity":"sha512-ITeyhxQLPTOQOzjQ4q8joGOAjiCUX1A6ebD4xmibDE2qjdmUqGc4JRbVg/Y6NyN2E3bvmNVowAqR38lOvkHzYw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEzfoknFOz0zerXDAXIK6WRYfto0W3xRp/PeZsc2dlzIAiEA2PD4inHn5Z0uFGZmLIV6UWfbR99kdn0XtiBqQruZS1A="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]},"0.4.1":{"name":"convoy","version":"0.4.1","author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"description":"Pluggable, package-aware asset pipeline for node","keywords":["asset","pipeline","connect","jake","build","tools"],"homepage":"http://github.com/node-convoy/convoy","bugs":{"url":"http://github.com/node-convoy/convoy/issues"},"repository":{"type":"git","url":"http://github.com/node-convoy/convoy.git"},"main":"./lib/index.js","dependencies":{"async":"0.1.x","uglify-js":"~1.2","uglifycss":"~0.0.5","glob":"~3.1","mime":"~1.2","coffee-script":"~1.3","connect":"~2.2","commander":"~0.5","detective":"~0.2.1"},"devDependencies":{"should":"latest","mocha":"latest","dox":"latest","temp":"latest"},"scripts":{"test":"./node_modules/.bin/mocha --reporter list"},"bin":{"convoy":"./bin/convoy"},"readme":"# Convoy\n\nConvoy is a package-aware, pluggable asset pipeline for node applications. You\ncan use it to generate static assets either as a part of a live server or via \na build tool chain.\n\n## Using Shared Libraries In Static Assets\n\nBecause Convoy is package-aware, you can include modules, CSS, and other assets\nfrom packages you install from npm or other sources. Including assets in your\nbuild couldn't be easier - just `require()` them!\n\nFor example, to include the popular `async` library in your client side app, \njust add it to your dependencies in you package json and then in your _client\nside_ javascript:\n\n    var async = require('async');\n\nThat's all you have to do! When you build your assets, convoy will notice this\nrequire() and automatically pull in the async module assets.\n\nConvoy technically can include JavaScript from any NPM package. However, the \ncode itself must not use any node-specific APIs since they will not be \navailable in the browser.\n\nIn addition to JavaScript, packages can also include CSS and legacy (i.e. \nnon-CommonJS module-based) JavaScript. See the section on \"CSS and Legacy\nJavaScript\" below for more info.\n\n## Using Convoy\n\nTo use convoy, you must integrate it into your server code or build scripts.\nYou can find some examples of how to do this in the examples directory. \n\nGenerally, creating a convoy pipeline is simple. Just invoke the convoy \nfunction and pass a config defining your assets:\n\n    var convoy = require('convoy');\n    var path   = require('path);\n\n    // create a new pipeline with an app.js and app.css file.\n    var pipeline = convoy({\n      'app.js': {\n        packager: 'javascript',  // selects some default plugins\n        main:  path.resolve('app/main.js'), // starting module to include\n        minify: true // must be set to minify output\n      },\n\n      'app.css': {\n        packager: 'css',\n        main: path.resolve('app/styles') // includes app/styles/index.css\n      },\n\n      'assets': {\n        packager: 'copy',\n        root: 'app/assets'\n      }\n    });\n\nThe pipeline above will know who to generate two assets:\n\n    * `app.js` will include the module found at `'app/main.js'` plus any \n      modules (in any package) required by the module.\n    * `app.css` will include the module found at `'app/styles/index.css`' plus\n      any css files (in any package) required by that file.\n\nIt will also be able to copy any assets found in the `'app/assets'` directory.\nThey will be available under the `assets` directory in the built output.\n\nOnce you have created a pipeline, you can either build the assets into memory\nor write them to a file on disk. You will generally want to just build the \nassets if you are using the pipeline in a server and write to disk if you are\nusing the pipeline in a build script.\n\nWhen using Convoy with a server you will want to use the `exists()` and \n`build()` methods:\n\n    // returns true if the passed path matches a file in the pipeline, \n    // including an asset found in the copy task.\n    pipeline.exists('app.js', function(exists) {\n      // handle ..\n    });\n\n    // builds app.js, returning a hash with the body and other attributes for\n    // streaming to a server.\n    pipeline.build('app.js', function(err, asset) {\n      if (err) handle_error(err);\n      return_asset(asset.body);\n    });\n\nWhen using Convoy as part of a build task, you will want to use the \n`writeFile()` and `writeAllFiles()` tasks:\n\n    // writes app.js to the build directory `public`. Invokes callback when \n    // completed.\n    pipeline.writeFile('app.js', path.resolve('public'), function(err) {\n      if (err) handle_error(err);\n      // go to next step..\n    });\n\n    // writes ALL files known to the asset pipeline to disk.\n    pipeline.writeAllFiles(path.resolve('public'), function(err) {\n      if (err) handle_error(err);\n      // go to next step\n    });\n\nEventually I would like to include some rebuilt tasks and a connect middleware\n(already stubbed in at pipeline.js). Patches welcome if you would find these\nuseful.\n\n## CSS and Legacy JavaScript\n\nIn addition to modular JavaScript, Convoy also supports building CSS and \nlegacy JavaScript files. Since neither of these types of assets support the \n`require()` function, Convoy instead looks for require comments similar to the\nones defined by the Rails Pipeline. Here is how you can make a CSS file that\nincludes two other CSS files before it:\n\n    /* index css */\n    /*= require ./reset.css */\n    /*= require ./type.css */\n    /*= require bootstrap/styles */\n\nThis example file would include `reset.css` and `type.css` stylesheets before\nthe current one as well as any stylesheets found in the mythical `bootstrap`\npackage installed via npm.\n\nLegacy JavaScript files work the same way. To build an asset with legacy \njavascript instead of modules, use the `legacy_javascript` packager when \nconfiguring your pipeline:\n\n    pipeline = convoy({\n      'legacy.js': {\n        packager: 'legacy_javascript',\n        main: 'vendor/index.js'\n      }\n    });\n\nThis will select a set of default plugins that will just merge the JavaScript\ninstead of packing it in CommonJS modules.\n\n\n## Plugins - Building Other Asset Types\n\nIf Convoy doesn't handle all the file types you want or behave in exactly the\nright way for you, it is incredibly easy to customize it via plugins.\n\nWhen Convoy builds an asset, it passes the asset through several different\nstages, each driven by a separate plugin. Plugins all have\nthe same interface. They are just functions with the following signature:\n\n    function ConvoyPlugin(asset, context, done) {\n\n    }\n\nThe `asset` parameter is an object that describes the current asset. In general\nyour plugin will read and modify properties on this object.\n\nThe `context` parameter as an object that contains some utility functions as \nwell as the config settings you passed to the `convoy()` function when you\nsetup the pipeline.\n\nThe `done` parameter is a callback you should invoke (with an optional error)\nwhen your plugin is finished with its work.\n\nThere are seven different types of plugins, called in order when you build an\nasset:\n\n  1.  **compile** - called once for each input file. This plugin should load\n      the file contents into the `body` property on the asset. Implement a \n      compiler if you want to add support for another language like CoffeeScript\n      or LESS.\n\n  2.  **preprocessors** - an array of optional plugins, these are called on\n      each input file just after compile. This allows you to do global \n      manipulation on the file. For example you might remove asserts, etc.\n\n  3.  **analyzer** - called once for each input file to extract dependency\n      and module information. This is the plugin you would write if you want\n      some new way to extract dependencies. (such as using the `@import` tag\n      in LESS).\n\n  4.  **linker** - merges all the input files into a single asset. The passed\n      asset will have an `assets` property that is an ordered array of assets\n      to merge. The linker should generate a new body and set it to the `body`\n      property. Implement a linker if you want to control how assets are \n      merged. CommonJSLinker, for example, wraps modules and adds a default\n      loader.\n\n  5.  **postprocessors** - optional array of plugins, these are called on\n      the merged asset just after it is linked but before it is minified. You\n      might do extra code stripping, etc.\n\n  6.  **minifier** - if the `minify` config is set to true, this plugin will be\n      called to minify the merged asset. Implement if you want to define your\n      own minifier.\n\n  7.  **finalizers** - optional array of plugins called after minification.\n      Implement to add final markup such as copyright statements.\n\n## Using Plugins\n\nTo configure your own plugins, you just set them in your pipeline config. You\ncan also make module ids, in which case the exports of the module must be \nthe plugin function:\n\n    // add a custom finalizer to add a copyright statement and setup plugins \n    // to compile LESS with the (currently) fictional `convoy-less` package.\n\n    var COPYRIGHT = '// copyright 2012 MyCompany, Inc.\\n\\n';\n    function CopyrightFinalizer(asset, context, done) {\n      asset.body = COPYRIGHT + asset.body;\n      done();\n    }\n\n    var pipeline = convoy({\n\n      'app.js': {\n        packager: 'javascript',\n        main: path.resolve('app/main.js'),\n\n        finalizers: [CopyrightFinalizer]\n      },\n\n      'app.css': {\n        packager: 'css',\n        main: path.resolve('app/assets/main.less'),\n\n        compilers: {\n          '.less': 'convoy-less/pipeline_plugins/less_compiler'\n        },\n        minifier: 'convoy-less/pipeline_plugins/css_minifier'\n      }\n    });\n\n## Hacking/Contributing\n\nIf you'd like to make some changes to Convoy, just \n[fork it on github](http://github.com/charlesjolley/convoy), make your change, \nadd a unit test, and send me a pull request.\n\nTo run unit tests first run `npm install` on the project to add dependencies\nand then run `make test`.\n\n## Asking Questions\n\n[StackOverflow](http://stackoverflow.com/questions/tagged/convoy)\n\n## TODO\n\nThere are lots of things still to do. See TODOS.txt and Github Issues for some.\n\n## Copyright/License\n\ncopyright 2012 Charles Jolley and contributors\nMIT License.\n\n\n\n","readmeFilename":"README.md","_id":"convoy@0.4.1","dist":{"shasum":"7a6e2b28f97337d0147ca4f6ec315517965d0d5a","tarball":"https://registry.npmjs.org/convoy/-/convoy-0.4.1.tgz","integrity":"sha512-05l48JBpQord6TCSiH/Qh8v5NPwztJ64mgyczYTLBVMkyMiNv53XMaHRGSs03l9J/WchmW1tPcErAiGYQZvKbA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGhN1oVGyUq3SZgNxvUzAl1ELPUjyee811BEFpRjQvjQAiAnkycdSYC7tcrqeRCQJkc1x4iD7Jpd38znzcBS7IQzLg=="}]},"_npmVersion":"1.2.0","_npmUser":{"name":"charlesjolley","email":"charles@sproutcore.com"},"maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}]}},"readme":"# Convoy\n\nConvoy is a package-aware, pluggable asset pipeline for node applications. You\ncan use it to generate static assets either as a part of a live server or via \na build tool chain.\n\n## Using Shared Libraries In Static Assets\n\nBecause Convoy is package-aware, you can include modules, CSS, and other assets\nfrom packages you install from npm or other sources. Including assets in your\nbuild couldn't be easier - just `require()` them!\n\nFor example, to include the popular `async` library in your client side app, \njust add it to your dependencies in you package json and then in your _client\nside_ javascript:\n\n    var async = require('async');\n\nThat's all you have to do! When you build your assets, convoy will notice this\nrequire() and automatically pull in the async module assets.\n\nConvoy technically can include JavaScript from any NPM package. However, the \ncode itself must not use any node-specific APIs since they will not be \navailable in the browser.\n\nIn addition to JavaScript, packages can also include CSS and legacy (i.e. \nnon-CommonJS module-based) JavaScript. See the section on \"CSS and Legacy\nJavaScript\" below for more info.\n\n## Using Convoy\n\nTo use convoy, you must integrate it into your server code or build scripts.\nYou can find some examples of how to do this in the examples directory. \n\nGenerally, creating a convoy pipeline is simple. Just invoke the convoy \nfunction and pass a config defining your assets:\n\n    var convoy = require('convoy');\n    var path   = require('path);\n\n    // create a new pipeline with an app.js and app.css file.\n    var pipeline = convoy({\n      'app.js': {\n        type: 'javascript',  // selects some default plugins\n        main:  path.resolve('app/main.js'), // starting module to include\n        minify: true // must be set to minify output\n      },\n\n      'app.css': {\n        type: 'css',\n        main: path.resolve('app/styles') // includes app/styles/index.css\n      },\n\n      'assets': {\n        type: 'copy',\n        root: 'app/assets'\n      }\n    });\n\nThe pipeline above will know who to generate two assets:\n\n    * `app.js` will include the module found at `'app/main.js'` plus any \n      modules (in any package) required by the module.\n    * `app.css` will include the module found at `'app/styles/index.css`' plus\n      any css files (in any package) required by that file.\n\nIt will also be able to copy any assets found in the `'app/assets'` directory.\nThey will be available under the `assets` directory in the built output.\n\nOnce you have created a pipeline, you can either build the assets into memory\nor write them to a file on disk. You will generally want to just build the \nassets if you are using the pipeline in a server and write to disk if you are\nusing the pipeline in a build script.\n\nWhen using Convoy with a server you will want to use the `exists()` and \n`build()` methods:\n\n    // returns true if the passed path matches a file in the pipeline, \n    // including an asset found in the copy task.\n    pipeline.exists('app.js', function(exists) {\n      // handle ..\n    });\n\n    // builds app.js, returning a hash with the body and other attributes for\n    // streaming to a server.\n    pipeline.build('app.js', function(err, asset) {\n      if (err) handle_error(err);\n      return_asset(asset.body);\n    });\n\nWhen using Convoy as part of a build task, you will want to use the \n`writeFile()` and `writeAllFiles()` tasks:\n\n    // writes app.js to the build directory `public`. Invokes callback when \n    // completed.\n    pipeline.writeFile('app.js', path.resolve('public'), function(err) {\n      if (err) handle_error(err);\n      // go to next step..\n    });\n\n    // writes ALL files known to the asset pipeline to disk.\n    pipeline.writeAllFiles(path.resolve('public'), function(err) {\n      if (err) handle_error(err);\n      // go to next step\n    });\n\nEventually I would like to include some rebuilt tasks and a connect middleware\n(already stubbed in at pipeline.js). Patches welcome if you would find these\nuseful.\n\n## CSS and Legacy JavaScript\n\nIn addition to modular JavaScript, Convoy also supports building CSS and \nlegacy JavaScript files. Since neither of these types of assets support the \n`require()` function, Convoy instead looks for require comments similar to the\nones defined by the Rails Pipeline. Here is how you can make a CSS file that\nincludes two other CSS files before it:\n\n    /* index css */\n    /*= require ./reset.css */\n    /*= require ./type.css */\n    /*= require bootstrap/styles */\n\nThis example file would include `reset.css` and `type.css` stylesheets before\nthe current one as well as any stylesheets found in the mythical `bootstrap`\npackage installed via npm.\n\nLegacy JavaScript files work the same way. To build an asset with legacy \njavascript instead of modules, use the `legacy_javascript` type when \nconfiguring your pipeline:\n\n    pipeline = convoy({\n      'legacy.js': {\n        type: 'legacy_javascript',\n        main: 'vendor/index.js'\n      }\n    });\n\nThis will select a set of default plugins that will just merge the JavaScript\ninstead of packing it in CommonJS modules.\n\n\n## Plugins - Building Other Asset Types\n\nIf Convoy doesn't handle all the file types you want or behave in exactly the\nright way for you, it is incredibly easy to customize it via plugins.\n\nWhen Convoy builds an asset, it passes the asset through several different\nstages, each driven by a separate plugin. Plugins all have\nthe same interface. They are just functions with the following signature:\n\n    function ConvoyPlugin(asset, context, done) {\n\n    }\n\nThe `asset` parameter is an object that describes the current asset. In general\nyour plugin will read and modify properties on this object.\n\nThe `context` parameter as an object that contains some utility functions as \nwell as the config settings you passed to the `convoy()` function when you\nsetup the pipeline.\n\nThe `done` parameter is a callback you should invoke (with an optional error)\nwhen your plugin is finished with its work.\n\nThere are seven different types of plugins, called in order when you build an\nasset:\n\n  1.  **compile** - called once for each input file. This plugin should load\n      the file contents into the `body` property on the asset. Implement a \n      compiler if you want to add support for another language like CoffeeScript\n      or LESS.\n\n  2.  **preprocessors** - an array of optional plugins, these are called on\n      each input file just after compile. This allows you to do global \n      manipulation on the file. For example you might remove asserts, etc.\n\n  3.  **analyzer** - called once for each input file to extract dependency\n      and module information. This is the plugin you would write if you want\n      some new way to extract dependencies. (such as using the `@import` tag\n      in LESS).\n\n  4.  **linker** - merges all the input files into a single asset. The passed\n      asset will have an `assets` property that is an ordered array of assets\n      to merge. The linker should generate a new body and set it to the `body`\n      property. Implement a linker if you want to control how assets are \n      merged. CommonJSLinker, for example, wraps modules and adds a default\n      loader.\n\n  5.  **postprocessors** - optional array of plugins, these are called on\n      the merged asset just after it is linked but before it is minified. You\n      might do extra code stripping, etc.\n\n  6.  **minifier** - if the `minify` config is set to true, this plugin will be\n      called to minify the merged asset. Implement if you want to define your\n      own minifier.\n\n  7.  **finalizers** - optional array of plugins called after minification.\n      Implement to add final markup such as copyright statements.\n\n## Using Plugins\n\nTo configure your own plugins, you just set them in your pipeline config. You\ncan also make module ids, in which case the exports of the module must be \nthe plugin function:\n\n    // add a custom finalizer to add a copyright statement and setup plugins \n    // to compile LESS with the (currently) fictional `convoy-less` package.\n\n    var COPYRIGHT = '// copyright 2012 MyCompany, Inc.\\n\\n';\n    function CopyrightFinalizer(asset, context, done) {\n      asset.body = COPYRIGHT + asset.body;\n      done();\n    }\n\n    var pipeline = convoy({\n\n      'app.js': {\n        type: 'javascript',\n        main: path.resolve('app/main.js'),\n\n        finalizers: [CopyrightFinalizer]\n      },\n\n      'app.css': {\n        type: 'css',\n        main: path.resolve('app/assets/main.less'),\n\n        compilers: {\n          '.less': 'convoy-less/pipeline_plugins/less_compiler'\n        },\n        minifier: 'convoy-less/pipeline_plugins/css_minifier'\n      }\n    });\n\n## Hacking/Contributing\n\nIf you'd like to make some changes to Convoy, just \n[fork it on github](http://github.com/charlesjolley/convoy), make your change, \nadd a unit test, and send me a pull request.\n\nTo run unit tests first run `npm install` on the project to add dependencies\nand then run `make test`.\n\n## Asking Questions\n\n[StackOverflow](http://stackoverflow.com/questions/tagged/convoy)\n\n## TODO\n\nThere are lots of things still to do. See TODOS.txt and Github Issues for some.\n\n## Copyright/License\n\ncopyright 2012 Charles Jolley and contributors\nMIT License.\n\n\n\n","maintainers":[{"name":"charlesjolley","email":"charles@sproutcore.com"}],"time":{"modified":"2022-06-13T22:58:34.356Z","created":"2012-04-26T23:45:21.066Z","0.1.0":"2012-04-26T23:45:22.569Z","0.1.1":"2012-04-26T23:59:09.441Z","0.1.2":"2012-04-27T01:38:01.452Z","0.2.0":"2012-04-29T17:54:19.067Z","0.3.0":"2012-05-07T22:16:39.097Z","0.3.1":"2012-05-20T00:00:08.671Z","0.3.2":"2012-05-20T00:34:00.199Z","0.4.0":"2012-10-21T06:56:17.364Z","0.4.1":"2013-01-17T00:10:44.499Z"},"author":{"name":"Charles Jolley","email":"charles@sproutcore.com"},"repository":{"type":"git","url":"http://github.com/node-convoy/convoy.git"}}