gpt4 book ai didi

node.js - Gulp 突然编译得非常慢

转载 作者:搜寻专家 更新时间:2023-10-31 22:33:38 25 4
gpt4 key购买 nike

最近,不知为何,我对严格 sass 任务的 gulp 编译时间变得极度慢。他们现在平均每次编译大约 18-20 秒,这非常慢。我尝试从 ruby​​-sass 切换到 node-sass,但 node-sass 似乎不支持我需要的几乎任何 3.3 sass 语法(特别是映射)。之前都在ms范围内;我从来不记得它们甚至超过 1。

这是我的 sass 任务文件:

var gulp         = require('gulp');
var sass = require('gulp-ruby-sass');
var autoprefixer = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var handleErrors = require('../util/handleErrors');
var browserSync = require('browser-sync');

gulp.task('styl', function() {
return gulp.src('styl/src/screen.scss')
.pipe(sass({sourcemap: false, style: 'compact'}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('styl/bld'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('../bld'))
.pipe(notify({ message: 'Styles task complete' }))
.pipe(browserSync.reload({ stream: true, notify: false }))
.on('error', handleErrors);
});

这是最近的 gulp 运行,还有:

[11:56:22] Starting 'setWatch'...
[11:56:22] Finished 'setWatch' after 44 μs
[11:56:22] Starting 'browserify'...
[11:56:22] Running 'bundle'...
[11:56:22] Starting 'uglify'...
[11:56:22] Finished 'uglify' after 11 ms
[11:56:22] Starting 'styl'...
[11:56:24] Finished 'bundle' in 1.76 s
[11:56:24] Finished 'browserify' after 1.76 s
[11:56:38] Finished 'styl' after 16 s
[11:56:38] Starting 'build'...
[11:56:38] Finished 'build' after 15 μs
[11:56:38] Starting 'browserSync'...
[11:56:38] Finished 'browserSync' after 6.28 ms
[11:56:38] Starting 'watch'...
[11:56:38] Finished 'watch' after 46 ms
[11:56:38] Starting 'default'...
[11:56:38] Finished 'default' after 32 μs
[BS] Proxy running. Use this URL: http://10.0.1.6:3002
[11:56:45] Starting 'styl'...
[BS] File Changed: screen.min.css
[BS] Injecting file into all connected browsers...
[11:57:05] Finished 'styl' after 20 s

最佳答案

这个问题的答案与 Gulp 无关,而是与链接到此 https://github.com/sass/sass/issues/1019 的评论中可能重复的内容有关。 .

我通过从 Susy 2.x 切换回 Susy 1.x 暂时解决了这个问题。根据 Kaij 在上面引用的链接中的评论,基本上每次在 Susy 中使用 span() 绝对是在扼杀编译时间:切换回 Susy 1.x 使我的编译时间从大约 24 秒缩短到大约 4 秒。我不确定这个问题是否与其他框架相关,但我认为可能是。

编辑:有关该问题的更多信息,特定于 Susy:https://github.com/ericam/susy/issues/325#issuecomment-47670013

关于node.js - Gulp 突然编译得非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24456189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com