Proxy remote server with local assets.
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-butchershop --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-butchershop');
In your project's Gruntfile, add a section named butchershop
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
butchershop: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
Butchershop delegates to Hapi for most requests. Current Butchershop v0.1.0
uses Hapi ~6.0.2
:
http://hapijs.com/api/v6.0.2
Especially relevant are:
Type: Object
Default: {}
Type: Object
Default: {}
Additionally, the plugin uses the following options to configure other aspects of the task:
Type: Object
Default: {}
Key-value pairs of server paths to chop to local paths. Keys are server HTTP path; values are the local file path with Gruntfile
directory as cwd
. E.g:
grunt.initConfig({
butchershop: {
main: {
options: {
chop: {
'/stylus/{path*}': './test/fixtures/stylus-local'
}
}
}
}
});
Type: String | Boolean
Default: false
If true
, opens the browser to the local proxied page. If a string, the option is treated as a path, eg:
grunt.initConfig({
butchershop: {
main: {
options: {
open: 'path/'
}
}
}
});
...should expect to open http://localhost:8000/path/
upon launch.
Type: Boolean
Default: false
Keep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will never run. By default, once grunt's tasks have completed, the web server stops. This option changes that behavior.
This option can also be enabled ad-hoc by running the task like grunt butchershop:targetname:keepalive
In 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 using Grunt.
- 2014-07011 v0.2.0 Updated Butchershop dependency and refined done() callback to avoid race condition.
- 2014-05-14 v0.1.2 Refined package.
- 2014-05-13 v0.1.1 Improved
open
functionality. Needs refinement in Butchershop to not have race condition. - 2014-05-13 v0.1.0 Initial Release
Copyright (c) 2014 Shane Daniel. Licensed under the MIT license.