我刚开始用口香糖。在我使用SASS和Compass之前。我遵循了本教程http://ericlbarnes.com/setting-gulp-bower-bootstrap-sass-fontawesome/
这一切都工作得很好,但是sass编译得非常慢,这是很烦人的。
我这是我的密码:
var gulp = require('gulp'),
sass = require('gulp-ruby-sass')
notify = require("gulp-notify")
bower = require('gulp-bower');
var config = {
sassPath: './scss',
bowerDir: './bower_components'
}
gulp.task('css', function() {
return gulp.src(config.sassPath + '/style.scss')
.pipe(sass({
style: 'compressed',
loadPath: [
'./scss',
config.bowerDir + '/bootstrap-sass-official/assets/stylesheets',
config.bowerDir + '/fontawesome/scss',
]
})
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
})))
.pipe(gulp.dest('./public/css'));
});
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('icons', function() {
return gulp.src(config.bowerDir + '/fontawesome/fonts/**.*')
.pipe(gulp.dest('./public/fonts'));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['css']);
});
gulp.task('default', ['bower', 'icons', 'css']);发布于 2015-08-24 19:44:42
我按建议换了一口。
我的代码:
var gulp = require('gulp'),
sass = require('gulp-sass')
notify = require("gulp-notify")
bower = require('gulp-bower');
var config = {
sassPath: './scss',
bowerDir: './bower_components'
}
gulp.task('css', function() {
gulp.src(config.sassPath + '/style.scss')
.pipe(sass({
style: 'compressed',
includePaths: [
'./scss',
config.bowerDir + '/bootstrap-sass-official/assets/stylesheets',
config.bowerDir + '/fontawesome/scss',
]
})
.on("error", notify.onError(function(error) {
return "Error: " + error.message;
})))
.pipe(gulp.dest('./public/css'));
});
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('icons', function() {
return gulp.src(config.bowerDir + '/fontawesome/fonts/**.*')
.pipe(gulp.dest('./public/fonts'));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['css']);
});
gulp.task('default', ['bower', 'icons', 'css']);https://stackoverflow.com/questions/32189707
复制相似问题