Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Gulp重新编译相关手写笔文件_Gulp_Stylus_Gulp Watch - Fatal编程技术网

通过Gulp重新编译相关手写笔文件

通过Gulp重新编译相关手写笔文件,gulp,stylus,gulp-watch,Gulp,Stylus,Gulp Watch,我有这样的想法: stylus/ dashboard.styl default.styl 这比那复杂得多,但要切中要害 (例如)在dashboard.styl内部,I@requireddefault.styl。当我对default.styl进行任何更改或修改时,Gulp(或Gulp watch或任何应该执行的操作)不会重新编译依赖文件 当我说依赖文件时,我指的是dashboard.styl 我认为,dashboard.styl具有default.styl作为@require依赖

我有这样的想法:

stylus/
    dashboard.styl
    default.styl
这比那复杂得多,但要切中要害

(例如)在
dashboard.styl
内部,I@required
default.styl
。当我对
default.styl
进行任何更改或修改时,Gulp(或Gulp watch或任何应该执行的操作)不会重新编译依赖文件

当我说依赖文件时,我指的是
dashboard.styl

我认为,
dashboard.styl
具有
default.styl
作为@require依赖于
default.styl
;因此,当它被更改时,
dashboard.styl
也应该被更改。但gulp watch不明白这一点

问题: 如何重新编译需要在其中更改文件的文件?


一些补充资料

gulpfile.js


我现在如何手动执行此操作:

当我在
default.styl
上进行一些更改时,我将转到命令提示符,停止当前正在运行的任务,并使用
gulp
命令重新运行它。在第一步编译所有文件时,它会让我喘不过气来,这就是我想要的(澄清:我必须要这样做!没有其他选择)


什么不是答案:我不想

  • 写一些东西来编译每次更改时我的所有文件
  • 手动编译我的文件

我需要有人告诉我有一种方法来实现这一点,以及如何做到这一点。谢谢。

这可能不是您想要的,但以下是我将如何完成您的目标。我将创建两个单独的gulp任务,一个用于观看,另一个用于编译。类似于我下面所说的。这样,每当在“监视”任务中指定的手写笔文件夹中更改手写笔文件时,它都将重新运行gulp手写笔编译任务

//查看所述文件
吞咽任务('watch',function(){
监视('/stylus folder/',function(){gulp.start('stylus');});
});
//更改文件时运行任务
吞咽任务('stylus',函数(){
gulp.src(stylusPath+'/*.styl')
.管子(管道工())
.管道(触针)({
压缩:真
}))
.管道(大口目的地(cssPath));

});它开始重新编译我所有的手写笔文件,我说这不是一个明确的答案;谢谢。对不起,你的措辞有点混乱,不过,我想我知道你想做什么。你需要做的是整合到你的工作流程中;很难解释我到底在找什么。但我认为大口改变可以解决我的问题。让我来测试一下。将在这里更新。这不是我想要的。因为我的一些文件需要在没有任何实际更改的情况下重新编译。其中包括文件a.styl,现在当a.styl上发生更改时,它无法识别该更改;但是需要重新编译它。
;!( function( w ) {

    'use strict';

    var gulp = require( 'gulp' ),
        stylus = require( 'gulp-stylus' ),

        watch = require( 'gulp-watch' ),

        plumber = require( 'gulp-plumber' ),

        stylusPath = 'public/stylus',
        cssPath = 'public/css';

    gulp.task( 'default', function() {

        gulp.src( stylusPath + '/*.styl' ).pipe( plumber() ).pipe( watch( stylusPath + '/*.styl' ) ).pipe( stylus({

            compress: true

        }) ).pipe( gulp.dest( cssPath ) );

    });

})( module );