Skip to content

Instantly share code, notes, and snippets.

@mach3 mach3/grunt-phps.js

Created Mar 26, 2014
Embed
What would you like to do?
Grunt task to run php built-in server
/**
* Grunt Task : phps
* -----------------
* Run php built-in server
*/
module.exports = function(grunt) {
grunt.registerMultiTask("phps", "", function() {
var exec, cmd, options;
exec = require("child_process").exec;
options = this.options({
port: 8080,
host: "localhost",
base: "./",
keepalive: false,
router: null
});
cmd = grunt.template.process(
"php -S <%=host %>:<%=port %> -t <%=base %> <%=router %>", {
data: options
}
);
if (options.keepalive) {
this.async();
}
exec(cmd);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.