Skip to content

Commit

Permalink
fix: transformed asset types is ignored (#1426)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mfranzke authored Feb 7, 2022
1 parent 4335660 commit 8cbe189
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/core/src/lib/copier.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ const copier = () => {
debug: patternlab.config.logLevel === 'debug',
};

// Adding assets to filter for in case of transformedAssetTypes defined; adapted regex from https://stackoverflow.com/a/6745455
if (patternlab.config.transformedAssetTypes) {
copyOptions.filter = new RegExp(
`.*(?<![.](${patternlab.config.transformedAssetTypes.join('|')}))$`,
'i'
);
}

//loop through each directory asset object (source / public pairing)

const copyPromises = [];
Expand Down Expand Up @@ -92,7 +100,7 @@ const copier = () => {
copyPromises.push(
_.map(patternlab.uikits, (uikit) => {
copyFile(
`${assetDirectories.source.root}/favicon.ico`,
`${assetDirectories.source.root}favicon.ico`,
path.join(
basePath,
uikit.outputDir,
Expand Down

0 comments on commit 8cbe189

Please sign in to comment.