Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active July 14, 2021 07:39
Embed
What would you like to do?
Gulp File , sass, browser-sync, local development. Assumes folder structure /assets/styles/ & /assets/js/
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
gulp.task('sass', function () {
gulp.src('./assets/styles/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest('./assets/styles'));
//.pipe(notify({ message: 'You so Sassy!' }));
});
gulp.task('browser-sync', function () {
browserSync.init(["./assets/styles/**/*.scss", "./assets/js/*.js", "*.php"], {
// server: {
proxy: "localurl.dev"
// }
});
});
gulp.task('watch', ['sass', 'browser-sync'], function () {
gulp.watch('./assets/styles/**/*scss', ['sass']);
gulp.watch("*.html").on("change", reload);
});
{
"devDependencies": {
"browser-sync": "^2.7.1",
"gulp": "^3.8.11",
"gulp-sass": "^2.0.0",
"gulp-util": "^3.0.4"
}
}
@barbwiredmedia
Copy link
Author

Needs work to add error reporting, linting, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment