Forked from ntry/bootstrap-tutorial-gulp4-gulpfile.js
Last active
August 8, 2019 01:18
-
-
Save lkimsey/912aea7eb3a1f14be8dc154309162190 to your computer and use it in GitHub Desktop.
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'); | |
| // 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')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment