Exemple #1
0
 return function(err, buffer, cb) {
     if (err) {
         cb(gutil.PluginError(PLUGIN_NAME, err));
     }
     var optimised = csso.justDoIt(String(buffer), optimise);
     cb(null, new Buffer(optimised));
 };
 return function(err, buffer, callback) {
   if (err) {
     callback(gutil.PluginError(PLUGIN_NAME, err));
   }
   var prefixed = prefix(opts).process(String(buffer)).css;
   callback(null, new Buffer(prefixed));
 };
Exemple #3
0
    stream.on('data', function (file) {
      if (file.isStream()) {
        this.emit('error', gutil.PluginError('gulp-usemin', 'Streams in assets are not supported!'));
      }

      file.base = path.resolve(file.base);
      file.path = path.resolve(file.path);
      files.push(file);
    });
Exemple #4
0
  return function(err, buf, cb) {

    // Handle any error
    if(err) cb(gutil.PluginError('minify-css', err));

    // Use the buffered content
    buf = Buffer(minify(opt, file, buf));

    // Bring it back to streams
    cb(null, buf);
  };
Exemple #5
0
	return through.obj(function (file, enc, cb) {
		var that = this;

		if (file.isNull()) {
			return cb(null, file); // pass along
		}

		if (file.isStream()) {
			return cb(gutil.PluginError('gulp-stylint', 'Streaming not supported'), file);
		}

		stylint(file.path, rules)
			.methods({
				read: function () {
					this.cache.filesLen = 1;
					this.cache.fileNo = 1;
					this.cache.file = file.path;
					this.cache.files = [file.path];
					this.state.quiet = true;

					if (reporter) {
						this.reporter = reporter;
						this.config.reporterOptions = reporterOptions;
					}

					this.parse(null, [file.contents.toString(enc)]);
				},
				done: function () {
					var warningsOrErrors = [].concat(this.cache.errs, this.cache.warnings);

					if (warningsOrErrors.length) {
						var msg = warningsOrErrors.filter(function (str) {
							return !!str;
						}).join('\n\n');
						msg += '\n' + this.cache.msg;
						file.stylint = {msg: msg, errors: this.cache.errs.length > 0, warnings: this.cache.warnings.length > 0};
					}

					// HACK: reset stylint, since it accidentally shares global state
					this.resetOnChange();

					that.push(file);
					cb();
				}
			})
			.create({}, options);
	});
    var collectResult = function (value, encoding, callback) {
        if (value.isNull()) {
            this.push(value);
            return callback();
        }

        if (value.isStream()) {
            this.emit("error", gutil.PluginError("gulp-jshintreporter", "Streaming not supported."));
            return callback();
        }

        var jshint = value.jshint;

        if (result === undefined) {
            result = {"success": jshint.success, "errors": jshint.results || []};
            return callback();
        }

        result.success = result.success && jshint.success;
        result.errors = jshint.results ? result.errors.concat(jshint.results) : result.errors;

        return callback();
    };
Exemple #7
0
 errorHandler: function (err) {
   throw gutil.PluginError('Dapple Build', err);
 }
 fs.writeFile(out, JSON.stringify(output), function (error) {
     if (error) {
         this.emit("error", gutil.PluginError("gulp-jshintreporter", "Report file [" + out + "] could not be written."));
     }
 });
Exemple #9
0
	.pipe(jade().on('error', function(err) {
		exit(gutil.PluginError('Jade', err));
	}))
Exemple #10
0
 newFile.contents.on('error', function() {
     stream.emit('error', gutil.PluginError(PLUGIN_NAME, err));
 });
Exemple #11
0
 bundler.bundle(opts).on('error', function() {
   stream.emit('error', gutil.PluginError(PLUGIN_NAME, err));
 }).on('data', function(chunk) {
Exemple #12
0
 bundler.on('error', function(err) {
     stream.emit('error', gutil.PluginError(PLUGIN_NAME, err));
 });