This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (47 loc) · 1.94 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// creating variables for each future task
//make sure that there is a dot before pipe --> .pipe
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const sass = require('gulp-sass');
//Compile Sass & Inject Into Browser
gulp.task('sass', function() {
// Compile any .scss extenction files fron an array.
return gulp.src(['node_modules/bootstrap/scss/bootstrap.scss','src/scss/*scss'])
//pipe sass function, which does this things
.pipe(sass())
// another pipe, says where to compile these files to. They will be turned into a regular css files
.pipe(gulp.dest('src/css'))
// call out our browser-sync stream functions
.pipe(browserSync.stream());
});
// Move JS files to src/js
gulp.task('js', function() {
//passing an array with file names
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'])
// moving to different directory
.pipe(gulp.dest("src/js"))
.pipe(browserSync.stream());
});
// Watch Sass & Server for any changes
gulp.task('serve', ['sass'], function() {
//initialising our browserSync and loading into server
browserSync.init({
server: "./src"
});
// Compiling any time we save it
gulp.watch(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'], ['sass']);
gulp.watch("src/*.html").on('change', browserSync.reload);
});
// Moving font awesome to src folder
gulp.task('fonts', function() {
return gulp.src('node_modules/font-awesome/fonts/*')
.pipe(gulp.dest('src/fonts'));
});
// Move Font Awesome CSS to src/css
gulp.task('fa', function() {
return gulp.src('node_modules/font-awesome/css/font-awesome.min.css')
.pipe(gulp.dest('src/css'));
});
// Run all tasks
gulp.task('default', ['js', 'serve', 'fa', 'fonts']);
//after this -- npm install -g gulp-cli