Created
February 18, 2016 15:39
-
-
Save infinitystylish/f47e09dfc52f5c820754 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-ruby-sass'), | |
spritesmith = require('gulp.spritesmith'), | |
compass = require('gulp-compass'), | |
path = require('path'), | |
minifyCss = require('gulp-minify-css'), | |
browserSync = require('browser-sync'), | |
tinypng = require('gulp-tinypng'), | |
autoprefixer = require('gulp-autoprefixer'), | |
plumber = require('gulp-plumber'); | |
/* npm install gulp.spritesmith */ | |
gulp.task('sprite', function () { | |
var spriteData = gulp.src('img/icons/*.png').pipe(spritesmith( | |
{ | |
retinaSrcFilter: ['img/icons/*-2x.png'], | |
imgName: 'sprite.png', | |
retinaImgName: 'sprite-2x.png', | |
cssName: '../sass/_sprite.scss', | |
imgPath : '../images/sprite.png', | |
retinaImgPath : '../images/sprite-2x.png' | |
} | |
)) | |
spriteData.pipe(gulp.dest('img/')); | |
}); | |
gulp.task('tinypng', function () { | |
gulp.src('images/**/*.png') | |
.pipe(tinypng('csIrxlzNbdpnGt8y0enqT0eZvlbv3Aj_')) | |
.pipe(gulp.dest('images/')); | |
}); | |
/**************************************************************/ | |
gulp.task('browser-sync', function() { | |
browserSync.init(["stylesheets/*.css", "js/*.js"], { | |
browser: ["google chrome"], | |
//browser: ["firefox"], | |
// browser: ["firefox","google chrome","safari"], | |
proxy: "http://dev2.quadratin.com.mx/wp/", | |
reloadDelay: 3000, | |
open: "external", | |
ghostMode: { | |
clicks: true, | |
forms: true, | |
scroll: false | |
} | |
}); | |
}); | |
gulp.task('compass', function() { | |
gulp.src('sass/*.scss') | |
.pipe(plumber()) | |
.pipe(compass({ | |
project: path.join(__dirname, '/'), | |
css: 'stylesheets', | |
sass: 'sass' | |
})) | |
//Comentar para no minificar | |
.pipe(minifyCss({compatibility: 'ie8'})) | |
.pipe(autoprefixer()) | |
.pipe(gulp.dest('stylesheets')); | |
}); | |
gulp.task('default', ['browser-sync'], function () { | |
gulp.watch("sass/*.scss", ['compass']); | |
gulp.watch("*.css").on("change", browserSync.reload); | |
gulp.watch("*.php").on("change", browserSync.reload); | |
gulp.watch("*.js").on("change", browserSync.reload); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment