1 Star 0 Fork 50

yuanhuajie/Gentelella

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gulpfile.js 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
sunny kushwaha 提交于 2019-11-18 18:18 . vulnerability solved
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
browserSync = require('browser-sync').create();
var DEST = 'build/';
gulp.task('scripts', function() {
return gulp.src([
'src/js/helpers/*.js',
'src/js/*.js',
])
.pipe(concat('custom.js'))
.pipe(gulp.dest(DEST+'/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(DEST+'/js'))
.pipe(browserSync.stream());
});
// TODO: Maybe we can simplify how sass compile the minify and unminify version
var compileSASS = function (filename, options) {
return sass('src/scss/*.scss', options)
.pipe(autoprefixer('last 2 versions', '> 5%'))
.pipe(concat(filename))
.pipe(gulp.dest(DEST+'/css'))
.pipe(browserSync.stream());
};
gulp.task('sass', function() {
return compileSASS('custom.css', {});
});
gulp.task('sass-minify', function() {
return compileSASS('custom.min.css', {style: 'compressed'});
});
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: './'
},
startPath: './production/index.html'
});
});
gulp.task('watch', function() {
// Watch .html files
gulp.watch('production/*.html', browserSync.reload);
// Watch .js files
gulp.watch('src/js/*.js', ['scripts']);
// Watch .scss files
gulp.watch('src/scss/*.scss', ['sass', 'sass-minify']);
});
// Default Task
gulp.task('default', gulp.series('browser-sync', 'watch'));
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/yuanhuajie/Gentelella.git
git@gitee.com:yuanhuajie/Gentelella.git
yuanhuajie
Gentelella
Gentelella
master

搜索帮助