Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Created July 22, 2015 16:09
Show Gist options
  • Save radiovisual/b621c2ebfc6af61c05e9 to your computer and use it in GitHub Desktop.
Save radiovisual/b621c2ebfc6af61c05e9 to your computer and use it in GitHub Desktop.
Base gulp file for auto-reloading of the browser and auto-min-cat of CSS
var gulp = require('gulp');
var minifyCSS = require('gulp-minify-css');
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var paths = {
css: ['./css/*.css'],
scripts: ['./js/*.js'],
html: ['./*.html']
};
gulp.task('default', ['browser-sync']);
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch(paths.html).on('change', browserSync.reload);
gulp.watch(paths.css, ['watch-css']);
});
gulp.task('watch-css', ['css'], function() {
browserSync.reload();
});
gulp.task('css', function() {
return gulp.src(paths.css)
.pipe(minifyCSS())
.pipe(concat('styles.min.css'))
.pipe(gulp.dest('./css/'));
});
{
"name": "Project-Name",
"version": "0.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {},
"devDependencies": {
"gulp-concat": "~2.5.2",
"browser-sync": "~2.7.6",
"gulp-minify-css": "~1.1.5",
"gulp": "~3.9.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Your Name",
"license": "BSD-2-Clause"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment