Gulp.js sass css编译非常慢(Gulp.js sass css compiling very slow)
我是新手使用gulpjs。 在我使用SASS和指南针之前。 我按照本教程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']);
I'm new to using gulpjs. Before I was using SASS and Compass. I followed this tutorial http://ericlbarnes.com/setting-gulp-bower-bootstrap-sass-fontawesome/
It all works fine, but the sass compiles very slowly which is annoying.
I This is my code:
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']);
原文:https://stackoverflow.com/questions/32189707
更新时间:2023-11-26 21:11