How to reuse code in pkl #114

Closed
opened 2025-12-30 01:21:01 +01:00 by adam · 2 comments
Owner

Originally created by @ruby109 on GitHub (Mar 12, 2024).

like I have a yml:

targetA :
    dependencies:
        - A
        - B
targetB:
    dependencies:
        - A
        - B

I only want to write the dependencies part once and use it in different target. How can I do it in pkl?

Originally created by @ruby109 on GitHub (Mar 12, 2024). like I have a yml: ``` yaml targetA : dependencies: - A - B targetB: dependencies: - A - B ``` I only want to write the `dependencies` part once and use it in different target. How can I do it in pkl?
adam closed this issue 2025-12-30 01:21:01 +01:00
Author
Owner

@odenix commented on GitHub (Mar 12, 2024):

local deps {
  "A"
  "B"
}
targetA {
  dependencies = deps
}
targetB {
  dependencies = deps
}

PS: I'd recommend to post questions under "Discussions".

@odenix commented on GitHub (Mar 12, 2024): ``` local deps { "A" "B" } targetA { dependencies = deps } targetB { dependencies = deps } ``` PS: I'd recommend to post questions under "Discussions".
Author
Owner

@ruby109 commented on GitHub (Mar 12, 2024):

@translatenix
Thank you very much.
I will pay attention next time🙇

@ruby109 commented on GitHub (Mar 12, 2024): @translatenix Thank you very much. I will pay attention next time🙇
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#114