This commit is contained in:
Brittany Chiang
2017-03-14 23:50:30 -04:00
parent 7e16ccdb46
commit 6cf1122d8e
6 changed files with 82 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin');
const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
// Build the Jekyll Site
gulp.task('jekyll-build', done => {
@@ -33,16 +33,7 @@ gulp.task('browser-sync', ['styles', 'scripts', 'jekyll-build'], () => {
});
});
const scssPath = ['_scss/**/*.scss','_scss/*.scss'];
const jsPath = ['_scripts/*.js'];
const templatePath = ['index.html', '404.html', '_layouts/*.html', '_includes/*.html', '_data/*.yml', '_posts/*', '_drafts/*', '**/*.html'];
gulp.task('watch', () => {
gulp.watch(scssPath, ['styles', 'jekyll-rebuild']);
gulp.watch(jsPath, ['scripts', 'jekyll-rebuild']);
gulp.watch(templatePath, ['jekyll-rebuild']);
});
// Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
gulp.task('styles', () => {
return gulp.src('_scss/*.scss')
.pipe(sass({
@@ -52,9 +43,11 @@ gulp.task('styles', () => {
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {cascade: true}))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('_site/css'))
// .pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('css'));
});
// Compile files from js folder into both _site/js folder (for live injecting)
gulp.task('scripts', () => {
return gulp.src('_scripts/*.js')
.pipe(jshint())
@@ -63,9 +56,20 @@ gulp.task('scripts', () => {
}))
.pipe(uglify())
.pipe(gulp.dest('_site/js'))
// .pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('js'));
});
const scssPath = ['_scss/**/*.scss','_scss/*.scss'];
const jsPath = ['_scripts/*.js'];
const templatePath = ['index.html', '404.html', '_layouts/*.html', '_includes/*.html', '_data/*.yml', '_posts/*', '_drafts/*', '**/*.html'];
gulp.task('watch', () => {
gulp.watch(scssPath, ['styles', 'jekyll-rebuild']);
gulp.watch(jsPath, ['scripts', 'jekyll-rebuild']);
gulp.watch(templatePath, ['jekyll-rebuild']);
});
gulp.task('images', () => {
return gulp.src('img/**/*.+(png|jpg|gif|svg)')
.pipe(imagemin())