2

背景

我正在使用 Stylus 为MyAnimeList.net制作自定义样式,使用 Gulp 作为构建系统。对于最终样式表,我需要:

  • 通过运行写入stdout我正在使用的外部程序 (.exe) 生成一些 CSS gulp-run
  • 连接 Stylus 编译器的输出和这个自动生成的 CSS,我遇到了问题。
  • 使用 Autoprefixer 添加前缀并缩小生成的 CSS(适用于单独的文件)

问题

gulp-concat在 gulp-run 产生的流上使用异常会崩溃(不支持流式处理)。使用vinyl-bufferorgulp-streamify让它静默失败。我找不到gulp-rungulp-concat或合作的方法gulp-concat-css

如果可能的话,我想避免创建临时文件。

示例 Gulpfile.coffee

这些任务都不会在构建文件夹中生成“example.txt”。

gulp         = require 'gulp'
run          = require 'gulp-run'
concat       = require 'gulp-concat'
streamify    = require 'gulp-streamify'
buffer       = require 'vinyl-buffer'

gulp.task 'fail_plain', ->
  run('echo Merged').exec()
    .pipe concat 'example.txt' # exception is thrown
    .pipe gulp.dest 'build/'

gulp.task 'fail_streamify', ->
  run('echo Merged').exec()
    .pipe streamify concat 'example.txt'
    .pipe gulp.dest 'build/' # no file written to output

gulp.task 'fail_vinyl_buffer', ->
  run('echo Merged').exec().pipe buffer()
    .pipe concat 'example.txt'
    .pipe gulp.dest 'build/' # no file written to output
4

0 回答 0