{"name":"grunt-browserify","description":"Grunt task for node-browserify","version":"1.2.7","homepage":"https://github.com/jmreidy/grunt-browserify","contributors":[{"name":"Justin Reidy","email":"jmreidy@rzrsharp.net"}],"repository":{"type":"git","url":"git://github.com/jmreidy/grunt-browserify.git"},"bugs":{"url":"https://github.com/jmreidy/grunt-browserify/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jmreidy/grunt-browserify/blob/master/LICENSE-MIT"}],"main":"grunt.js","engines":{"node":">= 0.8.x"},"scripts":{"test":"grunt test"},"dependencies":{"browserify-shim":"~2.0.8","through":"~2.3.4"},"devDependencies":{"browserify":"~2.33","grunt-contrib-jshint":"0.1.x","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.2.0","jsdom":"~0.6.0"},"peerDependencies":{"browserify":"~2.33","grunt":"~0.4.0"},"keywords":["gruntplugin","browserify","grunt"],"_id":"grunt-browserify@1.2.7","dist":{"shasum":"2d2085785a9c3c6edbae8b2194b14cb731a233fe","tarball":"http://registry-npm.ywwl.com/grunt-browserify/download/grunt-browserify-1.2.7.tgz","integrity":"sha512-SA4ADo1aB/snvbevxH/xdysfJ4I9eTOwE2zSKUwx2zaxjb78m6Uu+k9tZd2VZWoZFt0imp1s2hEea6T5kmxeLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCK023fnBxQ6EchNYdHxEe/OEdncbRBoDb4VN1yTff/7gIgApak5FsOSay0hMy/2pn70IfMS1wGxaU+ae/rYb4YmtI="}],"size":754495,"noattachment":false,"key":"/grunt-browserify/-/grunt-browserify-1.2.7.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"jmreidy","email":"jmreidy@rzrsharp.net"},"maintainers":[{"name":"jmreidy","email":"jmreidy@rzrsharp.net"}],"directories":{},"readme":"[![build status](https://secure.travis-ci.org/jmreidy/grunt-browserify.png)](http://travis-ci.org/jmreidy/grunt-browserify)\n[![NPM version](https://badge.fury.io/js/grunt-browserify.png)](http://badge.fury.io/js/grunt-browserify)\n# grunt-browserify\n\nGrunt task for node-browserify.\n\n## Getting Started\nThis plugin requires [Grunt](https://gruntjs.com) `~0.4.0`.\n\nInstall this grunt plugin with:\n```shell\nnpm install grunt-browserify --save-dev\n```\n\nThen add this line to your project's `grunt.js` Gruntfile:\n\n```javascript\ngrunt.loadNpmTasks('grunt-browserify');\n```\n\n## 3.0 Release\nAn important note for those running the latest release of grunt-browserify:\nthe newest version (>3.0) incorporates breaking changes from Browserify\nwhich REMOVED BUNDLE OPTIONS. All options to browserify must now be passed\nin the `browserifyOptions` hash.\n\n## In the Wild\nMost simply, Browserify is a tool for taking your CommonJS-style Javascript\ncode and packaging it for use in the browser. Grunt-Browserify provides the\nglue to better integrate Browserify into your Grunt-based development workflow.\n\nFor JavaScripters unfamiliar with CJS-style code and the Node ecosystem, moving\nto Browserify can be a bit confusing. Writing your client-side code as CJS\nmodules allows for smaller, easier to understand files that perform one task\nwell. These modules, because of their simplicity, will be significantly easier\nto use across projects. CJS modules also help to expose the dependency graph\ninherent in your code, allowing you to write cleaner, more-maintainable\nmodules. As [Alex MacCaw writes](http://spinejs.com/docs/commonjs):\n>CommonJS modules are one of the best solutions to JavaScript dependency\n>management.\n\n>CommonJS modules solve JavaScript scope issues by making sure each module is\n>executed in its own namespace. Modules have to explicitly export variables\n>they want to expose to other modules, and explicitly import other modules; in\n>other words, there's no global namespace.\n\n(A note to AMD fans that the benefits above are not unique to the CJS\nstyle of writing JavaScript modules, but the ease-of-interoperability with\nNode.JS code is a plus of CJS.)\n\nAs you begin to write your client-side code in small, reusable modules, you\nstart to have a lot more files to manage. At the same time, you need to\nintegrate these files with other client-side libraries, some of which do not\nplay particularly nicely with a CJS module system. The simplicity provided by\nCJS modules can be lost as build complexity is increased and Browserify\ncompilation time gets out of control.\n\n\n## Documentation\nRun this task with the `grunt browserify` command. As with other Grunt plugins, the `src` and `dest` properties are most important: `src` will use the Grunt glob pattern to specify files for inclusion in the browserified package, and `dest` will specify the outfile for the compiled module.\n\nThe current version of grunt-browserify sticks as close to the core browserify API as possible. Additional functionality can be added via the rich ecosystem of browserify transforms and plugins.\n\nThe following task options are supported:\n\n#### alias\nType: `Object{alias:path}`\n\nBrowserify can alias files or modules to a certain name. For example, `require('./foo')` can be aliased to be used as `require('foo')`.\n```js\noptions: {\n  alias: {\n    'foo': './foo.js'\n  }\n}\n```\n\nThe `alias` option is just a shortcut to require a file and expose a different name for it. You could do exactly the same thing using `require` instead of `alias`. It's equivalent to `require: [ ['./foo.js', {expose: 'foo'} ] ]`\n\nIf you need alias mappings, you can use @joeybaker's [remapify plugin](https://github.com/joeybaker/remapify), as demonstrated in the code below:\n\n```js\noptions: {\n  plugin: [\n    [\n      'remapify', [{\n          src: './client/views/**/*.js',  // glob for the files to remap\n          expose: 'views', // this will expose `__dirname + /client/views/home.js` as `views/home.js`\n          cwd: __dirname  // defaults to process.cwd()\n        }\n      ]\n    ]\n  ]\n}\n```\n\n#### banner\nType: `String`\nDefault: empty string\n\nThe string will be prepended to the output. Template strings (e.g. `<%= config.value %>` will be expanded automatically.\n\n#### require\nType: `[String]` or `[String:String]` or `[[String, Object]]`\n\nSpecifies files to be required in the browserify bundle. String filenames are parsed into their full paths with `path.resolve`. Aliases can be provided by using the `filePathString:aliasName` format.\n\nEach require can also be provided with an options hash; in this case, the require should be specified as an array of `[filePathString, optionsHash]`.\n\n#### ignore\nType: `[String]`\n\nSpecifies files to be ignored in the browserify bundle.\nString filenames are parsed into their full paths with `path.resolve`.\nGlobbing patterns are supported.\n\n#### exclude\nType: `[String]`\n\nSpecifies files or modules to be excluded in the browserify bundle.\nGlobbing patterns are supported; globbed filenames are parsed into their full paths.\n\n#### external\nType: `[String]` or `Object{alias:path}`.\n\nSpecifies id strings which will be loaded from a previously loaded, “common” bundle.\nThat is to say, files in the bundle that require the target String will assume\nthat the target is provided externally.\n\nThe secondary form of this option\nfollows the format of `alias` above, and will externalise the ids specified in\nthe alias object. This second form allows for the declaration of a single alias\nobject which can be supplied to one bundle's `alias` option and another option's\n`external` option.\n\nIn either case, globbing patterns are supported.\n\n\n#### transform\nType: `[String || Function]` or `[[String || Function,  Object]]`\n\nSpecifies a pipeline of functions (or modules) through which the browserified bundle will be run. The transform can either be a literal function, or a string referring to a NPM module. The [browserify docs themselves](https://github.com/substack/node-browserify#btransformtr) explain transform well, but below is an example of transform used with `grunt-browserify` to automatically compile coffeescript files for use in a bundle:\n\n```javascript\nbrowserify: {\n  dist: {\n    files: {\n      'build/module.js': ['client/scripts/**/*.js', 'client/scripts/**/*.coffee']\n    },\n    options: {\n      transform: ['coffeeify']\n    }\n  }\n}\n```\n\nTransforms can also be provided with an options hash; in this case, the transform should be specified as an array of `[transformStringOrFn, optionsHash]`.\n\nNote for [browserify-shim](https://github.com/thlorenz/browserify-shim), the configuration of this transformation has to be inside `package.json`. Please see documentation of `browserify-shim` and [our example](/examples/browserify-shim).\n\n#### plugin\nType: `[String || Function]`\nRegister a browserify plugin with the bundle. As with transforms, plugins are identified with either their NPM name (String) or a function literal.\n```javascript\nbrowserify: {\n  dev: {\n    options: {\n      plugin: [\n        'coffeeify', // register plugin by name\n        ['browserify-hmr', { noServe : true }] // register plugin with name and options\n      ]\n    }\n  }\n}\n```\n\n#### browserifyOptions\nType: Object\n\nA hash of options that are passed to browserify during instantiation. Task-level `browserifyOptions` are not merged into target-level options.\nIf a target overrides task-level `browserifyOptions`, it overrides all of it.\n[Browserify Github README](https://github.com/substack/node-browserify#var-b--browserifyfiles-or-opts)\n\n#### watch\nType: Boolean\nIf true, invoke [watchify](https://github.com/substack/watchify) instead of browserify.\n\nFor watchify to work properly, you have to keep the process running. The option `keepAlive` can help you do that, or you can use another `grunt-watch` task.\n\n#### cacheFile\n\nType: String\n\nSet to location of [browserify-incremental](https://github.com/jsdf/browserify-incremental) cache file and enable incremental builds via `browserify-incremental`. Mutually exclusive with `watchify`.\n\nNote that unlike `watchify`, this setting is fully compatible with `grunt-contrib-watch` and should be used together with it.\n\n#### keepAlive\nType: Boolean\nIf true and if `watch` above is true, keep the Grunt process alive (simulates grunt-watch functionality).\n\n#### watchifyOptions\nType: Object\nA hash of options that are passed to watchify during instantiation.\n[Watchify Github README](https://github.com/substack/watchify#var-w--watchifyb-opts)\n\n#### configure\nType: `Function (b)`\n\nAn optional callback function that is invoked once before the bundle runs. This can be used for programatically configuring browserify using it's API.\n`b` is the `browserify` instance for the bundle.\n\n#### preBundleCB\nType: `Function (b)`\n\nAn optional callback function, that will be called before bundle completion.\n`b` is the `browerify` instance that will output the bundle.\n\n__NB:__ This callback will be invoked every time the bundle is built so when used with the `watch` option set to true it will be called multiple times. Do not register transforms in this callback or they will end up being registered multiple times.\n\n#### postBundleCB\nType: `Function (err, src, next)`\n\nAn optional callback function, which will be called after bundle completion and\nbefore writing of the bundle. The `err` and `src` arguments are provided\ndirectly from browserify. The `next` callback should be called with `(err,\nmodifiedSrc)`; the `modifiedSrc` is what will be written to the output file.\n\n__NB:__ This callback will be invoked every time the bundle is built so when used with the `watch` option set to true it will be called multiple times.\n\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.\n\n## Release History\n\nSee the [CHANGELOG](https://github.com/jmreidy/grunt-browserify/blob/master/CHANGELOG.md).\n\n## License\nCopyright (c) 2013-2017 `grunt-browserify` contributors\nLicensed under the MIT license.\n","publish_time":1380566737366,"_cnpm_publish_time":1380566737366,"dist-tags":{"2.2.0-beta1":"3.0.0","beta":"3.0.0","latest":"6.0.0"}}