Skip to content

Commit

Permalink
Fix source map urls
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Jul 9, 2020
1 parent 7ce90ba commit 9fba730
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/subsetFonts.js
Expand Up @@ -1536,6 +1536,17 @@ These glyphs are used on your site, but they don't exist in the font you applied
relations.some((relation) => relation.type === 'CssSourceMappingUrl'),
},
});
for (const relation of assetGraph.findRelations({
type: 'SourceMapSource',
})) {
relation.hrefType = 'rootRelative';
}
for (const relation of assetGraph.findRelations({
type: 'CssSourceMappingUrl',
hrefType: { $in: ['relative', 'inline'] },
})) {
relation.hrefType = 'rootRelative';
}

for (const asset of potentiallyOrphanedAssets) {
if (asset.incomingRelations.length === 0) {
Expand Down
5 changes: 5 additions & 0 deletions test/subsetFonts.js
Expand Up @@ -4661,6 +4661,11 @@ describe('subsetFonts', function () {
await assetGraph.populate();
function checkSourceMap() {
const [sourceMap] = assetGraph.findAssets({ type: 'SourceMap' });
expect(sourceMap.parseTree.sources, 'to satisfy', {
0: expect
.it('to equal', 'styles.less')
.or('to equal', '/styles.less'),
});
const cssAsset = sourceMap.incomingRelations[0].from;
const generatedPosition = new LinesAndColumns(
cssAsset.text
Expand Down

0 comments on commit 9fba730

Please sign in to comment.