Skip to content

Commit 8cbe189

Browse files
authored
fix: transformed asset types is ignored (#1426)
* fix: transformedAssetTypes is ignored #1339 * chore: we could still use const here * chore: reduced unnecessary slash in the URL * refactor: simplified regex * refactor: simplified regex * refactor: corrected the regex as it was as well targeting .scss in configuring 'css' before
1 parent 4335660 commit 8cbe189

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/src/lib/copier.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ const copier = () => {
5555
debug: patternlab.config.logLevel === 'debug',
5656
};
5757

58+
// Adding assets to filter for in case of transformedAssetTypes defined; adapted regex from https://stackoverflow.com/a/6745455
59+
if (patternlab.config.transformedAssetTypes) {
60+
copyOptions.filter = new RegExp(
61+
`.*(?<![.](${patternlab.config.transformedAssetTypes.join('|')}))$`,
62+
'i'
63+
);
64+
}
65+
5866
//loop through each directory asset object (source / public pairing)
5967

6068
const copyPromises = [];
@@ -92,7 +100,7 @@ const copier = () => {
92100
copyPromises.push(
93101
_.map(patternlab.uikits, (uikit) => {
94102
copyFile(
95-
`${assetDirectories.source.root}/favicon.ico`,
103+
`${assetDirectories.source.root}favicon.ico`,
96104
path.join(
97105
basePath,
98106
uikit.outputDir,

0 commit comments

Comments
 (0)