Skip to content

Commit

Permalink
Add gulp config for js
Browse files Browse the repository at this point in the history
  • Loading branch information
proxycase committed Mar 17, 2020
1 parent 3e75d1d commit 216928c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var cachebust = require('gulp-cache-bust');
var reload = browserSync.reload;
var gulp = require('gulp')
var browserSync = require('browser-sync').create()
var sass = require('gulp-sass')
var autoprefixer = require('gulp-autoprefixer')
var cachebust = require('gulp-cache-bust')
var reload = browserSync.reload

gulp.task('sass', function() {
return gulp.src('src/scss/styles.scss')
return gulp
.src('src/scss/styles.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest('dest/css'))
.pipe(reload({stream: true}))
});
.pipe(reload({ stream: true }))
})

gulp.task('html', function() {
return gulp.src('./src/**/*.html')
.pipe(cachebust({type: 'timestamp'}))
return gulp
.src('./src/**/*.html')
.pipe(cachebust({ type: 'timestamp' }))
.pipe(gulp.dest('dest'))
.pipe(reload({stream: true}))
});
.pipe(reload({ stream: true }))
})

gulp.task('js', function() {
return gulp
.src('./src/**/*.js')
.pipe(cachebust({ type: 'timestamp' }))
.pipe(gulp.dest('dest'))
.pipe(reload({ stream: true }))
})

gulp.task('assets', function() {
return gulp.src('./src/assets/**/*')
.pipe(gulp.dest('dest/assets'))
});
return gulp.src('./src/assets/**/*').pipe(gulp.dest('dest/assets'))
})

gulp.task('serve', function() {
browserSync.init({
server: "./dest",
notify: false
});
server: './dest',
notify: false,
})

gulp.watch('src/**/*.html', gulp.series('html'))
gulp.watch('src/**/*.js', gulp.series('js'))
gulp.watch('src/scss/**/*.scss', gulp.series('sass'))
});
})

gulp.task('default', gulp.series('html', 'sass', 'assets', 'serve'));
gulp.task('default', gulp.series('html', 'js', 'sass', 'assets', 'serve'))
Empty file added src/js/script.js
Empty file.

0 comments on commit 216928c

Please sign in to comment.