通过Gulp将slim编译为html时遇到问题。 Gulp会编译一个空文件,内容为“无法找到Gemfile或.bundle /目录”。
有人可以帮我解决这个问题吗?
const gulp = require('gulp');
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const gulpSlim = require('gulp-slim');
const browserSync = require('browser-sync').create();
function slim() {
return (
gulp.src('./src/slim/page-home.slim')
.pipe( gulpSlim({
pretty: true,
bundler: true
}) )
.pipe( gulp.dest('./page-home') )
);
}
function style() {
return (
gulp.src('./src/scss/general/general.scss')
.pipe( sass({outputStyle: 'compressed'}) )
.pipe( rename('general.min.css') )
.pipe( gulp.dest('./dist/css') )
.pipe( browserSync.stream() )
);
};
function watch() {
browserSync.init({
server: {
baseDir: './'
}
});
gulp.watch('./src/scss/general/general.scss', style);
gulp.watch('./src/slim/page-home.slim', slim);
gulp.watch('./**/*.html').on('change', browserSync.reload);
}
exports.style = style;
exports.slim = slim;
exports.watch = watch;