|
| 1 | +const gulp = require('gulp'); |
| 2 | +const browserSync = require('browser-sync').create(); |
| 3 | +const sass = require('gulp-sass'); |
| 4 | + |
| 5 | +// Compile Sass & Inject into browser |
| 6 | +gulp.task('sass', function(){ |
| 7 | + return gulp.src(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss']) |
| 8 | + .pipe(sass()) |
| 9 | + .pipe(gulp.dest("src/css")) |
| 10 | + .pipe(browserSync.stream()); |
| 11 | +}) |
| 12 | + |
| 13 | +// Move Js files to our src/js |
| 14 | +gulp.task('js', function(){ |
| 15 | + 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']) |
| 16 | + .pipe(gulp.dest("src/js")) |
| 17 | + .pipe(browserSync.stream()); |
| 18 | +}) |
| 19 | + |
| 20 | +//Watch Sass & Server |
| 21 | +gulp.task('serve', ['sass'], function(){ |
| 22 | + browserSync.init({ |
| 23 | + server: "./src" |
| 24 | + }); |
| 25 | + |
| 26 | + gulp.watch(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'], ['sass']); |
| 27 | + gulp.watch("src/*.html").on('change', browserSync.reload); |
| 28 | +}) |
| 29 | + |
| 30 | +// Move Fonts folder to src |
| 31 | +gulp.task('fonts', function(){ |
| 32 | + return gulp.src('node_modules/font-awesome/fonts/*') |
| 33 | + .pipe(gulp.dest("src/fonts")); |
| 34 | +}) |
| 35 | + |
| 36 | +//Move Font Awesome css to src |
| 37 | +gulp.task('fa', function(){ |
| 38 | + return gulp.src('node_modules/font-awesome/css/font-awesome.min.css') |
| 39 | + .pipe(gulp.dest("src/css")); |
| 40 | +}) |
| 41 | + |
| 42 | +gulp.task('default', ['js', 'serve', 'fa', 'fonts']); |
0 commit comments