In my Javascript file, I have an array variable that is intended to be used with the Purgecss whitelistPatterns
option, specifically within the gulp-purgecss
plugin:
var purgeWLP = [
/^carousel-item.*/,
/collapsing/,
/show/,
];
I want to keep this array and other project variables in an external .json
file for easy access across different files. Here's what I've tried:
{
"wlp": [
"/^carousel-item.*/",
"/collapsing/",
"/show/"
]
}
However, I am facing errors and not achieving the desired outcome, which is to replicate the results of the purgeWLP
variable inside the javascript file.
How can I correctly store an array of regex values in a .json
file and retrieve it in Javascript?