Skip to content

Instantly share code, notes, and snippets.

@ntry
Created October 25, 2018 22:18
Show Gist options
  • Save ntry/8a87ecb8427f044211dc3bfa390ff971 to your computer and use it in GitHub Desktop.
Save ntry/8a87ecb8427f044211dc3bfa390ff971 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'])
.pipe(sass())
.pipe(gulp.dest("src/css"))
.pipe(browserSync.stream());
});
// Move the javascript files into our /src/js folder
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());
});
// Static Server + watching scss/html files
gulp.task('serve', gulp.series('sass', function() {
browserSync.init({
server: "./src"
});
gulp.watch(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'], gulp.series('sass'));
gulp.watch("src/*.html").on('change', browserSync.reload);
}));
gulp.task('default', gulp.parallel('js','serve'));
@pinghongchew
Copy link

Thanks bro

@mbennett10
Copy link

Thank you!!

@DKMDebugin
Copy link

Saviour!!!

@lavrovpy
Copy link

Thank you!!!

@webrafaelso
Copy link

thank you! you save me alot of time lol

@I-keep-trying
Copy link

THANK YOU! It wouldn't work until I found this in the comments! I wish the tutorial's author would respond, I still have questions!

@ganjie47
Copy link

ganjie47 commented Apr 2, 2019

save the day~~!

@Gouliath1
Copy link

thanks!

@Allmedialab
Copy link

Hi,
Thanks for the code! Can you please explain how I can import selective JavaScript from Bootstrap in this set up and change the bootstrap.min.js? I'm talking about @import 'node_modules/bootstrap/scss/_dropdown.scss'; for example.
Regard & Thanks,
David

@youngd24
Copy link

youngd24 commented Sep 2, 2019

Dude, you rock, thanks a ton!

@GlennKouhia
Copy link

Muy bueno. Gracias amigo.

@j-autuick
Copy link

Thank you! After 48 hours of fumbling with this, this really made my day.

@mista4chun
Copy link

legend thank you very much

@josecdeveloper
Copy link

You deserve the world!!! Thank you, seriously! Freaking legend!

@benhuur1
Copy link

Muito bom, resolveu meu problema.

@soufianedermoumi
Copy link

thank you

@martinmwarangu
Copy link

hero

@neverkas
Copy link

Thanks! :D

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