Skip to content

Instantly share code, notes, and snippets.

@dezoito
Created January 4, 2016 19:24
Show Gist options
  • Save dezoito/8ba32571315f6f0b0602 to your computer and use it in GitHub Desktop.
Save dezoito/8ba32571315f6f0b0602 to your computer and use it in GitHub Desktop.
Super simple Django + BrowserSync Gulpfile
// Assuming you already have NodeJS, npm and gulp installed
// and followed instructions at:
// https://www.browsersync.io/docs/gulp/
//
// save this file at <<DJANGO PROJECT ROOT>>
// on your terminal:
// $ cd <<DJANGO PROJECT ROOT>>
// $ gulp
// this will open a browser window with your project
// and reload it whenever a file with the extensions scss,css,html,py,js
// is changed
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('default', function() {
browserSync.init({
notify: false,
proxy: "localhost:8000"
});
gulp.watch(['./**/*.{scss,css,html,py,js}'], reload);
});
@datencoach
Copy link

with an actual install of gulp following line 23 needs to be replaced as follows:
gulp.watch(['./**/*.{scss,css,html,py,js}']).on('change', browserSync.reload);

line 16 can be deleted

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