Skip to content

Commit

Permalink
Inline stylesheet happens after import path fixup, so outputPath of r…
Browse files Browse the repository at this point in the history
…ewriteURL should be the overall outputPath

Use getTextContent when reading stylesheets
  • Loading branch information
dfreedm committed Apr 25, 2014
1 parent 4e927dd commit ab330f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/pathresolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

var path = require('path');
var constants = require('./constants.js');
var setTextContent = require('./utils.js').setTextContent;
var utils = require('./utils.js');
var setTextContent = utils.setTextContent;
var getTextContent = utils.getTextContent;

function resolvePaths($, input, output) {
var assetPath = path.relative(output, input);
Expand All @@ -32,7 +34,7 @@ function resolvePaths($, input, output) {
});
$(constants.CSS).each(function() {
var el = $(this);
var text = rewriteURL(input, output, el.text());
var text = rewriteURL(input, output, getTextContent(el));
setTextContent(el, text);
});
$(constants.ELEMENTS).each(function() {
Expand Down
2 changes: 1 addition & 1 deletion lib/vulcan.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function inlineSheets($, inputPath, outputPath) {
if (href && !excludeStyle(href)) {
var filepath = path.resolve(options.outputDir, href);
// fix up paths in the stylesheet to be relative to the location of the style
var content = pathresolver.rewriteURL(path.dirname(filepath), inputPath, readFile(filepath));
var content = pathresolver.rewriteURL(path.dirname(filepath), outputPath, readFile(filepath));
var styleDoc = cheerio.load('<style>' + content + '</style>');
// clone attributes
styleDoc('style').attr(el.attr());
Expand Down

0 comments on commit ab330f1

Please sign in to comment.