assetgraph
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -11,3 +11,3 @@ var path = require('path'), | ||
HtmlAlternateLink: '<link rel=alternate>', | ||
HtmlConditionalComment: '<!--[if ...]>', | ||
HtmlConditionalComment: function (htmlConditionalComment) {return '<!--[if ' + htmlConditionalComment.condition + ']>';}, | ||
HtmlImage: '<img>', | ||
@@ -48,10 +48,14 @@ HtmlAudio: '<audio>', | ||
} | ||
var label = relationLabelByType[relation.type] || ''; | ||
if (typeof label === 'function') { | ||
label = label(relation); | ||
} | ||
g.addEdge(relation.from.id, relation.to.id, { | ||
fontsize: '9', | ||
arrowhead: 'empty', | ||
label: "\"" + (relationLabelByType[relation.type] || '').replace(/\"/g, "\\\"") + "\"" | ||
label: "\"" + label.replace(/\"/g, "\\\"") + "\"" | ||
}); | ||
}); | ||
g.output(path.extname(targetFileName).substr(1), targetFileName); | ||
} | ||
}; | ||
}; |
@@ -17,13 +17,11 @@ var _ = require('underscore'), | ||
cssImages = assetGraph.findRelations({from: cssAsset, to: {isImage: true, isInline: false}}), | ||
cssImagesToInline = []; | ||
hasCssImagesToInline = false; | ||
cssImages.forEach(function (cssImage) { | ||
if (cssImage.cssRule.style.getPropertyValue('-one-image-inline')) { | ||
cssImage.cssRule.style.removeProperty('-one-image-inline'); | ||
cssAsset.markDirty(); | ||
cssImagesToInline.push(cssImage); | ||
} else if (sizeThreshold >= 0 && cssImage.to.rawSrc.length <= sizeThreshold && assetGraph.findRelations({from: cssAsset, to: cssImage.to}).length === 1) { | ||
cssImagesToInline.push(cssImage); | ||
if (cssImage.cssRule.style.getPropertyValue('-one-image-inline') || | ||
sizeThreshold >= 0 && cssImage.to.rawSrc.length <= sizeThreshold && assetGraph.findRelations({from: cssAsset, to: cssImage.to}).length === 1) { | ||
hasCssImagesToInline = true; | ||
} | ||
}); | ||
if (cssImagesToInline.length > 0) { | ||
if (hasCssImagesToInline > 0) { | ||
var document = htmlAsset.parseTree, | ||
@@ -41,3 +39,3 @@ internetExplorerConditionalCommentBody = new assets.Html({text: ""}), | ||
cssAsset.clone(new relations.HtmlStyle({to: cssAsset}).attach(internetExplorerConditionalCommentBody, 'first')); | ||
new relations.HtmlStyle({to: cssAsset}).attach(internetExplorerConditionalCommentBody, 'first'); | ||
@@ -49,8 +47,14 @@ new relations.HtmlConditionalComment({ | ||
new relations.HtmlStyle({to: cssAsset}).attach(nonInternetExplorerConditionalCommentBody, 'first'); | ||
var cssAssetClone = cssAsset.clone(new relations.HtmlStyle({to: cssAsset}).attach(nonInternetExplorerConditionalCommentBody, 'first')); | ||
htmlStyle.detach(); | ||
cssImagesToInline.forEach(function (cssImage) { | ||
cssImage.inline(); | ||
assetGraph.findRelations({from: cssAssetClone}).forEach(function (cssImage) { | ||
if (cssImage.cssRule.style.getPropertyValue('-one-image-inline')) { | ||
cssImage.cssRule.style.removeProperty('-one-image-inline'); | ||
cssAssetClone.markDirty(); | ||
cssImage.inline(); | ||
} else if (sizeThreshold >= 0 && cssImage.to.rawSrc.length <= sizeThreshold && assetGraph.findRelations({from: cssAsset, to: cssImage.to}).length === 1) { | ||
cssImage.inline(); | ||
} | ||
}); | ||
@@ -57,0 +61,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/One-com/assetgraph.git", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"maintainers": [ | ||
@@ -8,0 +8,0 @@ { |
@@ -28,3 +28,3 @@ var vows = require('vows'), | ||
'the not-Internet Explorer conditional comment construct should be intact': function (text) { | ||
assert.matches(text, /<!--\[if !IE\]><!-->Not IE<!--<!\[endif\]-->/); | ||
assert.matches(text, /<!--\[if !IE\]>\s*-->Not IE<!--\s*<!\[endif\]-->/); | ||
}, | ||
@@ -45,3 +45,3 @@ 'then externalizing the Css and JavaScript and minifying the Html': { | ||
assert.matches(text, /<script src="fixIE6ForTheLoveOfGod\.js"><\/script>/); | ||
assert.matches(text, /<!--\[if !IE\]><!-->Not IE<!--<!\[endif\]-->/); | ||
assert.matches(text, /<!--\[if !IE\]>\s*-->Not IE<!--\s*<!\[endif\]-->/); | ||
assert.matches(text, /<!--\[if IE\]><link rel="stylesheet" href="[^\"]+\.css"><!\[endif\]-->/); | ||
@@ -48,0 +48,0 @@ } |
Sorry, the diff of this file is not supported yet
595829
10066