Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transformedAssetTypes is ignored #1339

Closed
renestalder opened this issue Jul 19, 2021 · 6 comments · Fixed by #1426
Closed

transformedAssetTypes is ignored #1339

renestalder opened this issue Jul 19, 2021 · 6 comments · Fixed by #1426
Labels

Comments

@renestalder
Copy link

I am using Pattern Lab Node v5.15.0 on Linux, with Node v16, using a Twig Edition.

Expected Behavior

When using a preprocessor like PostCSS to process CSS files, you want to deactivate the copy task for CSS. To do this, based on the manual, I would set following property in my pattern lab configuration:

{
  "transformedAssetTypes": ["css", "js"]
}

Now building pattern lab, the public css folder set in paths.public.css should not contain any CSS files.

Actual Behavior

transformedAssetTypes seems to ignore the type "css". It copies all the CSS files as configured in paths.source.css to paths.public.css.

As the preprocessor might be faster in compliling, Pattern Lab is also gonna overwrite any previously compiled CSS.

Actually, after testing further, it seems that setting is not applied any file type. I tested it with .scss as file type by setting transformedAssetTypes to ["scss"] and file is still being copied despite the setting.

Steps to Reproduce
  1. Configure paths for CSS in paths.source.css and paths.public.css.
  2. Add a CSS file to the source path
  3. Set the transformedAssetTypes to ["css"].
  4. Run patternlab build --config ./patternlab-config.json
@renestalder
Copy link
Author

Is it possible it is only applied in the watch mode and not when building? The only reference for transformedAssetTypes I find in the code is in watchAssets.js.

https://github.com/pattern-lab/patternlab-node/blob/639801addbc95648bbb6b992944f332a5a0f4d2c/packages/core/src/lib/watchAssets.js

@mfranzke
Copy link
Contributor

mfranzke commented Jul 20, 2021

@renestalder thanks for reporting this topic. It even also seems to me that transformedAssetTypes is only being taken into account on watching the files, but not during build.

@JosefBredereck could you think of any valid reason for that? I would expect that the transformedAssetTypes is both necessary during watch as well as build, or am I missing something here (is the output of files probably differing intentionally)?

@JosefBredereck
Copy link
Contributor

JosefBredereck commented Jul 22, 2021

Phew, I don't know if this is the correct option. We have some old documentation here in the pattern lab wiki which does not match the patternlab.io website.

In my opinion, the functionality should do the same in watch and build mode, so that you don't have different results.

@JosefBredereck
Copy link
Contributor

Somewhere in the copier.js at transform_paths, we could add functionality to ignore specific paths, or in copyFile.js, we could add the option to ignore with transformedAssetTypes. I currently do not know If recursive-copy supports ignoring files or if we have to build something new here.

@stale
Copy link

stale bot commented Jan 9, 2022

It's hard to keep track of everything. This issue has been automatically marked as stale because it has not had recent activity, neither from the team nor the community. It will be closed if no further activity occurs. Please consider adding additional info, volunteering to contribute a fix for this issue, or making a further case that this is important to you, the team, and the project as a whole. Thanks!

@mfranzke
Copy link
Contributor

mfranzke commented Feb 4, 2022

I think that I'm nearly done with implementing a solution for this one.

mfranzke added a commit to mfranzke/patternlab-node that referenced this issue Feb 5, 2022
JosefBredereck pushed a commit that referenced this issue Feb 7, 2022
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants