Say I have a use case for my config file like this:
function generateText(thisIsAVariable) {
return `This is a sentence with a variable somewhere in the string
${thisIsAVariable} then more string... or not`;
}
I want to be able to import a config file that would transform the above:
import { SENTENCE_CONFIG } = "..."
// SENTENCE_CONFIG.some_sentence {"This is a sentence with a variable somewhere in the string
//[slug] then more string... or not"}
function generateText(thisIsAVariable) {
return SENTENCE_CONFIG.some_sentence;
// but have thisIsAVariable plugged in the appropriate "slug" so to speak
}
I know I can make a function to do this, but I want know if there is another way.