Last active
October 1, 2015 16:12
-
-
Save nicdev/cdff3f2515633fabea0a to your computer and use it in GitHub Desktop.
Super minimal PHP-only Gulpfile for local development
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
| // If you need something that does sass, sourcemaps, images optimization, etc. | |
| // go to https://gist.github.com/nicdev/79b0c686be0962a58b09 | |
| // this right here does PHP, and PHP only | |
| var gulp = require('gulp'); | |
| var browserSync = require('browser-sync'); | |
| var php = require('gulp-connect-php'); | |
| var reload = function() { | |
| setTimeout(browserSync.reload, 500); | |
| } | |
| var paths = { | |
| php: ['./**/*.php'] | |
| }; | |
| gulp.task('default', ['watch', 'browser-sync']); | |
| gulp.task('php', function(){ | |
| php.server({ | |
| base: '', | |
| port: 9999, | |
| keepalive: false, | |
| }); | |
| }); | |
| gulp.task('browser-sync', ['php'], function() { | |
| browserSync({ | |
| proxy: '127.0.0.1:9999', | |
| port: 10000, | |
| open: true, | |
| notify: false | |
| }); | |
| }); | |
| // Rerun the task when a file changes | |
| gulp.task('watch', function() { | |
| gulp.watch(paths.php, reload); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment