Created
February 22, 2018 14:46
-
-
Save iberno/c491a41a3b392e7e985347955e52d757 to your computer and use it in GitHub Desktop.
Environment Gulp Sass BrowserSync
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 browserSync = require('browser-sync').create(); | |
var sass = require('gulp-sass'); | |
//Compilar sass em CSS & injetar no navegador | |
gulp.task('sass', function(){ | |
return gulp.src(['src/scss/bootstrap.scss', 'src/scss/*.scss']) | |
.pipe(sass()) | |
.pipe(gulp.dest("src/css")) | |
.pipe(browserSync.stream()); | |
}); | |
//Mover JS para src/css | |
gulp.task('js', function() { | |
return gulp.src(['node_modules/bootstrap/dist/js/bootstrap.min.js', | |
'node_modules/jquery/dist/jquery.min.js', | |
'node_modules/popper.js/dist/umd/popper.min.js']) | |
.pipe(gulp.dest("src/js")) | |
.pipe(browserSync.stream()); | |
}); | |
//Seridor para compilar HTML/CSS | |
gulp.task('serve', ['sass'], function() { | |
browserSync.init({ | |
server: "./src" | |
}); | |
gulp.watch(['src/scss/bootstrap.scss', 'src/scss/*.scss'], ['sass']); | |
gulp.watch("src/*.html").on('change', browserSync.reload); | |
}); | |
//fim | |
gulp.task('default', ['js', 'serve']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment