Last active
June 2, 2016 05:44
-
-
Save btribouillet/83473e0262dffe348cf39f6f0c9f93cf to your computer and use it in GitHub Desktop.
This file contains 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'), | |
sass = require('gulp-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
cssnano = require('gulp-cssnano'), | |
rename = require('gulp-rename'), | |
uglify = require('gulp-uglify'), | |
concat = require('gulp-concat'), | |
plumber = require('gulp-plumber'); | |
var browserSync = require('browser-sync').create(); | |
gulp.task('styles', function() { | |
// Sass watch, autoprefixr, minify and rename | |
return gulp.src('scss/*.scss') | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(autoprefixer('last 2 version')) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(cssnano()) | |
.pipe(gulp.dest('../css')) | |
// Live reload for styles | |
.pipe(browserSync.stream()); | |
}); | |
// JS concat and minify | |
gulp.task('scripts', function() { | |
gulp.src(['js/*.js']) | |
.pipe(plumber()) | |
.pipe(concat('scripts.min.js')) | |
.pipe(uglify()) | |
.pipe(gulp.dest('../js')) | |
.pipe(browserSync.stream()); | |
}); | |
gulp.task('watch', function() { | |
gulp.watch('scss/*.scss', ['styles']); | |
gulp.watch('js/*.js', ['scripts']); | |
// Live reload for php files | |
gulp.watch(['**/*.php']) | |
.on('change', browserSync.reload); | |
}); | |
gulp.task('browser-sync', function() { | |
browserSync.init({ | |
proxy: "goliath-classic.dev" | |
}); | |
}); | |
gulp.task('default', ['watch', 'styles', 'scripts', 'browser-sync'], function() { | |
}); |
This file contains 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
{ | |
"name": "goliath", | |
"version": "1.0.0", | |
"description": "", | |
"main": "gulpfile.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "goliath", | |
"license": "ISC", | |
"devDependencies": { | |
"browser-sync": "^2.12.10", | |
"gulp": "^3.9.1", | |
"gulp-autoprefixer": "^3.1.0", | |
"gulp-concat": "^2.6.0", | |
"gulp-cssnano": "^2.1.2", | |
"gulp-plumber": "^1.1.0", | |
"gulp-rename": "^1.2.2", | |
"gulp-sass": "^2.3.1", | |
"gulp-uglify": "^1.5.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment