Created
May 28, 2016 05:16
-
-
Save sunilw/5647bee934781a991f84264945ede7ba to your computer and use it in GitHub Desktop.
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
var gulp = require('gulp') ; | |
var connect = require('gulp-connect-php'); | |
var sass = require('gulp-sass') ; | |
var watch = require('gulp-watch') ; | |
var sourcemaps = require('gulp-sourcemaps') ; | |
var browserSync = require('browser-sync'); | |
var concat = require('gulp-concat'); | |
var rename = require('gulp-rename'); | |
var uglify = require('gulp-uglify'); | |
var combiner = require('stream-combiner2'); | |
gulp.task('watch', function () { | |
gulp.watch('./src/sass/**.scss', ['sass']); | |
gulp.watch('./src/js/**.js', ['scripts']); | |
}); | |
gulp.task( 'sass', function() { | |
return gulp.src('./src/sass/**.scss') | |
.pipe(sourcemaps.init()) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(sourcemaps.write('./maps')) | |
.pipe(gulp.dest('./css')) | |
.pipe(browserSync.stream()) ; | |
}) ; | |
gulp.task('scripts', function() { | |
return gulp.src('./src/js/**.js') | |
.pipe(concat('ourfuture.js')) | |
.pipe(gulp.dest('./js')) | |
.pipe(uglify()) | |
.pipe(rename('ourfuture.min.js')) | |
.pipe(gulp.dest('./js')) ; | |
}); | |
gulp.task('serve', function() { | |
browserSync.init({ | |
server: { | |
baseDir: "./" | |
} | |
}); | |
gulp.watch("./js/**").on('change', browserSync.reload); | |
}); | |
gulp.task('connect-sync', function() { | |
connect.server({}, function (){ | |
browserSync({ | |
proxy: '127.0.0.1:8000' | |
}); | |
}); | |
gulp.watch('**/*.php').on('change', function () { | |
browserSync.reload(); | |
}); | |
gulp.watch('css/**').on('change', function () { | |
browserSync.reload(); | |
}); | |
}); | |
gulp.task('default', ['sass', 'scripts','watch', 'connect-sync']) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gulpfile with php-connect and browser-sync