-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix svg dependencies not being found when using minification (#1022)
- Loading branch information
1 parent
9858937
commit e3c90c4
Showing
6 changed files
with
51 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const posthtml = require('posthtml'); | ||
const htmlnano = require('htmlnano'); | ||
|
||
module.exports = async function(asset) { | ||
await asset.parseIfNeeded(); | ||
|
||
const htmlNanoConfig = asset.package.htmlnano || | ||
(await asset.getConfig(['.htmlnanorc', '.htmlnanorc.js'])) || { | ||
collapseWhitespace: 'conservative', | ||
minifyCss: { | ||
safe: true | ||
} | ||
}; | ||
|
||
let res = await posthtml([htmlnano(htmlNanoConfig)]).process(asset.ast, { | ||
skipParse: true | ||
}); | ||
|
||
asset.ast = res.tree; | ||
asset.isAstDirty = true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<svg xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
<use xlink:href="file.svg#all"/> | ||
</svg> |