Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.parEach(function (imageInfo, i) {
var processedAsset = new AssetGraph.assets.Png({
rawSrc: this.vars[i]
});
processedAsset.url = urlTools.resolveUrl(assetGraph.root, processedAsset.id + processedAsset.defaultExtension);
assetGraph.addAsset(processedAsset);
imageInfo.incomingRelations.forEach(function (incomingRelation) {
var style = incomingRelation.cssRule.style;
style.removeProperty(postProcessPropertyName);
if (imageInfo.ie6) {
// Designates that the processed image should only be used in IE6
// Keep the original relation and use the underscore hack for getting
// IE6 to fetch the processed version:
if (('_' + incomingRelation.propertyName) in style) {
throw new Error("transforms.postProcessCssImages: Underscore hack already in use in Css rule");
}
style.setProperty('_' + incomingRelation.propertyName, 'url(...)', style.getPropertyPriority(incomingRelation.propertyName));
var relation = new AssetGraph.relations.CssImage({
var childProcess = require('child_process'),
_ = require('underscore'),
seq = require('seq'),
urlTools = require('assetgraph/lib/util/urlTools'),
pipeImageThroughChildProcessAndBuffer = require('../pipeImageThroughChildProcessAndBuffer'),
passError = require('passerror'),
AssetGraph = require('assetgraph'),
postProcessPropertyName = AssetGraph.assets.Css.vendorPrefix + 'image-postprocess';
function applyFilters(buffer, filters, cb) {
if (filters.length === 0) {
return process.nextTick(function () {
cb(null, buffer);
});
}
var nextFilterNum = 0;
function proceed () {
if (nextFilterNum < filters.length) {
var nextFilter = filters[nextFilterNum];
nextFilterNum += 1;
nextFilter(buffer, passError(cb, function (resultBuffer) {
buffer = resultBuffer;
proceed();