Last active
January 4, 2016 14:49
-
-
Save zulfajuniadi/8636398 to your computer and use it in GitHub Desktop.
grunt php dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
shell: { | |
bower: { | |
options: { | |
stdout: true, | |
}, | |
command: 'bower-requirejs -c public_html/js/main.js -e requirejs' | |
} | |
}, | |
watch: { | |
development: { | |
files: ['app/**/*.php', 'public_html/css/*.css', 'public_html/js/**/*.js'], | |
options: { | |
livereload: true, | |
}, | |
}, | |
less: { | |
files: 'public_html/less/*.less', | |
tasks: ['compileLess'], | |
}, | |
}, | |
less: { | |
development: { | |
options: { | |
paths: ["public_html/less"] | |
}, | |
files: { | |
"public_html/css/main.css": "public_html/less/main.less" | |
} | |
}, | |
}, | |
bgShell: { | |
_defaults: { | |
bg: true | |
}, | |
runPHPServer: { | |
execOpts: { | |
cwd: './public_html' | |
}, | |
cmd: 'php -S localhost:5000 -t ./ ../server.php', | |
}, | |
runArtisanServer: { | |
cmd: 'artisan serve', | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-bg-shell'); | |
grunt.loadNpmTasks('grunt-shell'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-less'); | |
grunt.registerTask('compileLess', ['less:development']); | |
grunt.registerTask('bower', ['shell:bower']); | |
grunt.registerTask('default', ['bgShell:runArtisanServer', 'watch']); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sometimes git timesout during bower-requirejs; We can fix this by running bower list in offline mode | |
file: /usr/local/lib/node_modules/bower-requirejs/lib/index.js | |
#line: 39 | |
See: https://github.com/yeoman/bower-requirejs/issues/71 | |
*/ | |
function run() { | |
bower.commands.list({}, { | |
offline: true | |
}) | |
.on('end', function (data) { | |
if (data) { | |
writeConfig(buildPaths(data.dependencies)); | |
} | |
}) | |
.on('error', function (err) { | |
console.error(danger('ERR'), process.argv.slice(2).join(' '), '\n'); | |
console.error(opts.debug ? err.stack : err.message); | |
process.exit(err.code || 1); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"grunt": "~0.4.2", | |
"grunt-contrib-watch": "~0.5.3", | |
"grunt-contrib-less": "~0.9.0", | |
"grunt-bg-shell": "~2.3.1", | |
"bower-requirejs": "~0.9.0", | |
"grunt-shell": "~0.6.4" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
npm install | |
npm install -g bower-requirejs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment