Best way to import ts or js code as string
Unanswered
Belgian Hare posted this in #help-forum
Belgian HareOP
Hi, I would like to import typescript as a string into another file. I'd like to keep it as a .ts file so that I can have automated tests against the code to ensure it works but I'd primarilly want this code to be in string form as an example in my docs. Any recommendation on how I can achieve this?
2 Replies
@Belgian Hare Hi, I would like to import typescript as a string into another file. I'd like to keep it as a .ts file so that I can have automated tests against the code to ensure it works but I'd primarilly want this code to be in string form as an example in my docs. Any recommendation on how I can achieve this?
u can read the file from your realtive project path using something like fs from node
relative*