Last active
May 6, 2017 08:13
-
-
Save gus3inov/5b69b7ef7651b9982a4297adc072de97 to your computer and use it in GitHub Desktop.
Gulp task
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'), | |
minifycss = require('gulp-minify-css'), | |
rename = require('gulp-rename'), | |
browserSync = require('browser-sync').create(), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglifyjs'); | |
gulp.task('browser-sync', ['styles', 'scripts'], function() { | |
browserSync.init({ | |
server: { | |
baseDir: "./app" | |
}, | |
notify: false | |
}); | |
}); | |
gulp.task('styles', function () { | |
return gulp.src('sass/*.sass') | |
.pipe(sass({ | |
includePaths: require('node-bourbon').includePaths | |
}).on('error', sass.logError)) | |
.pipe(rename({suffix: '.min', prefix : ''})) | |
.pipe(autoprefixer({browsers: ['last 15 versions'], cascade: false})) | |
.pipe(minifycss()) | |
.pipe(gulp.dest('app/css')) | |
.pipe(browserSync.stream()); | |
}); | |
gulp.task('scripts', function() { | |
return gulp.src([ | |
'./app/libs/modernizr/modernizr.js', | |
'./app/libs/jquery/jquery-1.11.2.min.js', | |
'./app/libs/waypoints/waypoints.min.js', | |
'./app/libs/animate/animate-css.js', | |
'./app/libs/plugins-scroll/plugins-scroll.js', | |
'./app/libs/superfish/dist/js/superfish.min.js', | |
'./app/libs/owl.carousel/dist/owl.carousel.min.js', | |
]) | |
.pipe(concat('libs.js')) | |
// .pipe(uglify()) //Minify libs.js | |
.pipe(gulp.dest('./app/js/')); | |
}); | |
gulp.task('watch', function () { | |
gulp.watch('sass/*.sass', ['styles']); | |
gulp.watch('app/libs/**/*.js', ['scripts']); | |
gulp.watch('app/js/*.js').on("change", browserSync.reload); | |
gulp.watch('app/*.html').on('change', browserSync.reload); | |
}); | |
gulp.task('default', ['browser-sync', 'watch']); |
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": "gulp-project", | |
"version": "1.0.0", | |
"description": "First Gulp Project", | |
"devDependencies": { | |
"browser-sync": "^2.11.0", | |
"gulp": "^3.9.0", | |
"gulp-autoprefixer": "^2.3.1", | |
"gulp-concat": "^2.6.0", | |
"gulp-minify-css": "^1.2.0", | |
"gulp-rename": "^1.2.2", | |
"gulp-sass": "^2.0.4", | |
"gulp-uglifyjs": "^0.6.2", | |
"node-bourbon": "^4.2.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment