build working, need to separate browsersync

This commit is contained in:
Brittany Chiang
2017-03-15 13:38:19 -04:00
parent 4c9f0e8914
commit 5f684c5f4b
6 changed files with 101 additions and 97 deletions

View File

@@ -31,6 +31,7 @@ exclude:
- "*.gemspec" - "*.gemspec"
- "README.md" - "README.md"
- "node_modules" - "node_modules"
- "build"
- "gulpfile.js" - "gulpfile.js"
- "package.json" - "package.json"

View File

@@ -1,11 +1,11 @@
// const fontsPath = 'fonts/**/*'; const fontsPath = 'fonts/**/*';
// const destPath = '_site/fonts'; const destPath = '_site/fonts';
// module.exports = gulp => { module.exports = gulp => {
// gulp.task('fonts', () => { gulp.task('fonts', () => {
// return gulp.src( fontsPath ) return gulp.src( fontsPath )
// .pipe(gulp.dest( destPath )); .pipe(gulp.dest( destPath ));
// }); });
// } }

View File

@@ -1,14 +1,14 @@
// const imagemin = require('gulp-imagemin'); const imagemin = require('gulp-imagemin');
// const imgPath = 'img/**/*.+(png|jpg|gif|svg)'; const imgPath = 'img/**/*.+(png|jpg|gif|svg)';
// const destPath = '_site/img'; const destPath = '_site/img';
// module.exports = gulp => { module.exports = gulp => {
// gulp.task('images', () => { gulp.task('images', () => {
// return gulp.src( imgPath ) return gulp.src( imgPath )
// .pipe(imagemin()) .pipe(imagemin())
// .pipe(gulp.dest( destPath )); .pipe(gulp.dest( destPath ));
// }); });
// } }

View File

@@ -1,21 +1,21 @@
// const sass = require('gulp-sass'); const sass = require('gulp-sass');
// const prefix = require('gulp-autoprefixer'); const prefix = require('gulp-autoprefixer');
// const cleanCSS = require('gulp-clean-css'); const cleanCSS = require('gulp-clean-css');
// const scssPath = '_scss/*.scss'; const scssPath = '_scss/*.scss';
// const destPath = '_site/css'; const destPath = '_site/css';
// module.exports = gulp => { module.exports = gulp => {
// gulp.task('sass', () => { gulp.task('sass', () => {
// return gulp.src( scssPath ) return gulp.src( scssPath )
// .pipe(sass({ .pipe(sass({
// includePaths: ['scss'], includePaths: ['scss'],
// outputStyle: 'expanded' outputStyle: 'expanded'
// })) }))
// .pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {cascade: true})) .pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {cascade: true}))
// .pipe(cleanCSS({compatibility: 'ie8'})) .pipe(cleanCSS({compatibility: 'ie8'}))
// .pipe(gulp.dest( destPath )) .pipe(gulp.dest( destPath ))
// .pipe(gulp.dest('css')); .pipe(gulp.dest('css'));
// }); });
// } }

View File

@@ -1,21 +1,21 @@
// const jshint = require('gulp-jshint'); const jshint = require('gulp-jshint');
// const babel = require('gulp-babel'); const babel = require('gulp-babel');
// const uglify = require('gulp-uglify'); const uglify = require('gulp-uglify');
// const jsPath = '_scripts/*.js'; const jsPath = '_scripts/*.js';
// const destPath = '_site/js'; const destPath = '_site/js';
// module.exports = gulp => { module.exports = gulp => {
// gulp.task('scripts', () => { gulp.task('scripts', () => {
// return gulp.src( jsPath ) return gulp.src( jsPath )
// .pipe(jshint()) .pipe(jshint())
// .pipe(babel({ .pipe(babel({
// presets: ['es2015'] presets: ['es2015']
// })) }))
// .pipe(uglify()) .pipe(uglify())
// .pipe(gulp.dest( destPath )) .pipe(gulp.dest( destPath ))
// .pipe(gulp.dest( 'js' )); .pipe(gulp.dest( 'js' ));
// }); });
// } }

View File

@@ -3,19 +3,19 @@
const gulp = require('gulp'); const gulp = require('gulp');
const browserSync = require('browser-sync'); const browserSync = require('browser-sync');
const cp = require('child_process'); const cp = require('child_process');
const sass = require('gulp-sass'); // const sass = require('gulp-sass');
const prefix = require('gulp-autoprefixer'); // const prefix = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css'); // const cleanCSS = require('gulp-clean-css');
const jshint = require('gulp-jshint'); // const jshint = require('gulp-jshint');
const babel = require('gulp-babel'); // const babel = require('gulp-babel');
const uglify = require('gulp-uglify'); // const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin'); // const imagemin = require('gulp-imagemin');
const sass = require('./build/sass');
const scripts = require('./build/scripts');
const images = require('./build/images');
const fonts = require('./build/fonts');
// const sync = require('./build/browsersync'); // const sync = require('./build/browsersync');
// const sass = require('./build/sass');
// const scripts = require('./build/scripts');
// const images = require('./build/images');
// const fonts = require('./build/fonts');
const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll'; const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
@@ -31,7 +31,7 @@ gulp.task('jekyll-rebuild', ['jekyll-build'], () => {
}); });
// Wait for jekyll-build task to complete, then launch the Server // Wait for jekyll-build task to complete, then launch the Server
gulp.task('browser-sync', ['styles', 'scripts', 'jekyll-build'], () => { gulp.task('browser-sync', ['sass', 'scripts', 'jekyll-build'], () => {
browserSync({ browserSync({
server: { server: {
baseDir: '_site' baseDir: '_site'
@@ -44,46 +44,49 @@ const jsPath = ['_scripts/*.js'];
const templatePath = ['index.html', '404.html', '_layouts/*.html', '_includes/*.html', '_data/*.yml', '_posts/*', '_drafts/*', '**/*.html']; const templatePath = ['index.html', '404.html', '_layouts/*.html', '_includes/*.html', '_data/*.yml', '_posts/*', '_drafts/*', '**/*.html'];
gulp.task('watch', () => { gulp.task('watch', () => {
gulp.watch(scssPath, ['styles', 'jekyll-rebuild']); gulp.watch(scssPath, ['sass', 'jekyll-rebuild']);
gulp.watch(jsPath, ['scripts', 'jekyll-rebuild']); gulp.watch(jsPath, ['scripts', 'jekyll-rebuild']);
gulp.watch(templatePath, ['jekyll-rebuild']); gulp.watch(templatePath, ['jekyll-rebuild']);
}); });
gulp.task('styles', () => { // gulp.task('styles', () => {
return gulp.src('_scss/*.scss') // return gulp.src('_scss/*.scss')
.pipe(sass({ // .pipe(sass({
includePaths: ['scss'], // includePaths: ['scss'],
onError: browserSync.notify // onError: browserSync.notify
})) // }))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {cascade: true})) // .pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {cascade: true}))
.pipe(cleanCSS({compatibility: 'ie8'})) // .pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('_site/css')) // .pipe(gulp.dest('_site/css'))
.pipe(gulp.dest('css')); // .pipe(gulp.dest('css'));
}); // });
gulp.task('scripts', () => { // gulp.task('scripts', () => {
return gulp.src('_scripts/*.js') // return gulp.src('_scripts/*.js')
.pipe(jshint()) // .pipe(jshint())
.pipe(babel({ // .pipe(babel({
presets: ['es2015'] // presets: ['es2015']
})) // }))
.pipe(uglify()) // .pipe(uglify())
.pipe(gulp.dest('_site/js')) // .pipe(gulp.dest('_site/js'))
.pipe(gulp.dest('js')); // .pipe(gulp.dest('js'));
}); // });
gulp.task('images', () => { // gulp.task('images', () => {
return gulp.src('img/**/*.+(png|jpg|gif|svg)') // return gulp.src('img/**/*.+(png|jpg|gif|svg)')
.pipe(imagemin()) // .pipe(imagemin())
.pipe(gulp.dest('_site/img')); // .pipe(gulp.dest('_site/img'));
}); // });
gulp.task('fonts', () => { // gulp.task('fonts', () => {
return gulp.src('fonts/**/*') // return gulp.src('fonts/**/*')
.pipe(gulp.dest('_site/fonts')); // .pipe(gulp.dest('_site/fonts'));
}); // });
[ sass, scripts, images, fonts ].forEach( task => {
task( gulp );
});
gulp.task('serve', ['browser-sync', 'watch']); gulp.task('serve', ['browser-sync', 'watch']);
gulp.task('build', ['styles', 'scripts', 'images', 'fonts', 'jekyll-build']); gulp.task('build', ['sass', 'scripts', 'images', 'fonts', 'jekyll-build']);