mirror of
https://github.com/Xevion/old.xevion.github.io.git
synced 2025-12-06 01:15:33 -06:00
v3
This commit is contained in:
@@ -3,33 +3,39 @@ const cp = require('child_process');
|
||||
|
||||
const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
|
||||
|
||||
const scssPath = ['_scss/**/*.scss'];
|
||||
const jsPath = ['_scripts/*.js'];
|
||||
const templatePath = [ '*.html', '+(_includes|_layouts)/*.html', '*.yml', '_data/*.yml', '_posts/*'];
|
||||
const scssPath = '_scss/**/*.scss';
|
||||
const jsPath = '_scripts/*.js';
|
||||
const templatePath = ['*.html', '+(_includes|_layouts)/*.html', '*.yml', '_data/*.yml', '_posts/*'];
|
||||
|
||||
module.exports = gulp => {
|
||||
|
||||
// run `jekyll build`
|
||||
gulp.task('jekyll-build', done => {
|
||||
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
|
||||
.on('close', done);
|
||||
return cp.spawn(jekyll, ['build'], {stdio: 'inherit'})
|
||||
.on('close', done);
|
||||
});
|
||||
|
||||
// run `jekyll build` with _config_dev.yml
|
||||
gulp.task('jekyll-dev', done => {
|
||||
return cp.spawn(jekyll, ['build', '--config', '_config.yml,_config_dev.yml'], {stdio: 'inherit'})
|
||||
.on('close', done);
|
||||
});
|
||||
|
||||
// Rebuild Jekyll then reload the page
|
||||
gulp.task('jekyll-rebuild', ['jekyll-build'], () => {
|
||||
gulp.task('jekyll-rebuild', ['jekyll-dev'], () => {
|
||||
browserSync.reload();
|
||||
});
|
||||
|
||||
gulp.task('serve', ['jekyll-build'], () => {
|
||||
gulp.task('serve', ['jekyll-dev'], () => {
|
||||
browserSync.init({
|
||||
server: {
|
||||
baseDir: '_site'
|
||||
}
|
||||
});
|
||||
|
||||
gulp.watch(scssPath, ['sass', 'jekyll-rebuild']);
|
||||
gulp.watch(jsPath, ['scripts', 'jekyll-rebuild']);
|
||||
gulp.watch(scssPath, ['sass', browserSync.reload]);
|
||||
gulp.watch(jsPath, ['scripts', browserSync.reload]);
|
||||
gulp.watch(templatePath, ['jekyll-rebuild']);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
const fontsPath = 'fonts/**/*';
|
||||
const destPath = '_site/fonts';
|
||||
|
||||
module.exports = gulp => {
|
||||
|
||||
gulp.task('fonts', () => {
|
||||
return gulp.src( fontsPath )
|
||||
.pipe(gulp.dest( destPath ));
|
||||
});
|
||||
|
||||
}
|
||||
@@ -6,9 +6,9 @@ const destPath = '_site/img';
|
||||
module.exports = gulp => {
|
||||
|
||||
gulp.task('images', () => {
|
||||
return gulp.src( imgPath )
|
||||
.pipe( imagemin() )
|
||||
.pipe(gulp.dest( destPath ));
|
||||
return gulp.src(imgPath)
|
||||
.pipe(imagemin())
|
||||
.pipe(gulp.dest(destPath));
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,19 +7,19 @@ const destPath = '_site/css';
|
||||
|
||||
module.exports = gulp => {
|
||||
|
||||
gulp.task( 'sass', () => {
|
||||
return gulp.src( scssPath )
|
||||
.pipe( sass( {
|
||||
includePaths: ['scss'],
|
||||
outputStyle: 'expanded'
|
||||
} ) )
|
||||
.pipe( prefix( {
|
||||
browsers: [ 'last 2 versions' ],
|
||||
cascade: false
|
||||
} ) )
|
||||
.pipe( cleanCSS( {compatibility: 'ie8'} ) )
|
||||
.pipe( gulp.dest( destPath ) )
|
||||
.pipe( gulp.dest( 'css' ) );
|
||||
gulp.task('sass', () => {
|
||||
return gulp.src(scssPath)
|
||||
.pipe(sass({
|
||||
includePaths: ['scss'],
|
||||
outputStyle: 'expanded'
|
||||
}))
|
||||
.pipe(prefix({
|
||||
browsers: ['last 2 versions'],
|
||||
cascade: false
|
||||
}))
|
||||
.pipe(cleanCSS({ compatibility: 'ie8' }))
|
||||
.pipe(gulp.dest(destPath))
|
||||
.pipe(gulp.dest('css'));
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,36 +1,20 @@
|
||||
const eslint = require('gulp-eslint');
|
||||
const babel = require('gulp-babel');
|
||||
const uglify = require('gulp-uglify');
|
||||
const pump = require('pump');
|
||||
|
||||
const jsPath = '_scripts/*.js';
|
||||
const destPath = '_site/js';
|
||||
|
||||
module.exports = gulp => {
|
||||
|
||||
// gulp.task('scripts', function (cb) {
|
||||
// console.log('compress');
|
||||
// pump([
|
||||
// gulp.src(jsPath),
|
||||
// uglify(),
|
||||
// gulp.dest(destPath)
|
||||
// ],
|
||||
// cb
|
||||
// );
|
||||
// });
|
||||
|
||||
gulp.task( 'scripts', () => {
|
||||
return gulp.src( jsPath )
|
||||
.pipe( eslint( {
|
||||
useEslintrc: true
|
||||
} ) )
|
||||
// .pipe( eslint.format() )
|
||||
.pipe(babel({
|
||||
presets: ['es2015']
|
||||
}))
|
||||
.pipe( uglify() )
|
||||
.pipe( gulp.dest( destPath ) )
|
||||
.pipe( gulp.dest( 'js' ) );
|
||||
gulp.task('scripts', () => {
|
||||
return gulp.src(jsPath)
|
||||
.pipe(eslint({
|
||||
useEslintrc: true
|
||||
}))
|
||||
.pipe(eslint.format())
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(destPath))
|
||||
.pipe(gulp.dest('js'));
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user