Пример #1
0
  function pragma(file, encoding, callback) {
    if (file.isNull()) {
      return callback(null, file);
    }

    if (file.isStream()) {
      return callback(new gutil.PluginError('gulp-pragma', 'Doesn\'t support Streams'));
    }

    if (cfg) {
      if (istextorbinary.isTextSync(file.path, file.contents)) {
        var tContents = file.contents.toString('utf-8');
        for (var pgma in cfg) {
          if (pgma.toLowerCase() == 'all') {
            if (cfg[pgma] === false) {
              tContents = stripAllPragma(tContents);
            }
          } else {
            if (cfg[pgma] === false) {
              tContents = stripPragma(pgma, tContents);
            }
          }
        }
        file.contents = new Buffer(tContents, 'utf-8');
      }
    }

    callback(null, file);
  }
Пример #2
0
  return transformAllFiles(function(file, enc) {
    if (multimatch(file.relative, self.options.filerev).length) {
      self.filerev[file.relative] = {
        regexp:     new RegExp(STARTING_DELIMITER + escapeRegExp(webPath.call(self, file)) + ENDING_DELIMITER, 'g'),
        references: []
      };
    }

    if (multimatch(file.relative, self.options.replace).length && istextorbinary.isTextSync(null, file.contents)) {
      self.replace[file.relative] = {
        contents: String(file.contents)
      };
    }
  });
 .pipe(ignore.include(file => istextorbinary.isTextSync(file.basename, file.contents)))