How to load an external js file as plain text and assign to variable as a
string
Really sorry if this is a dumb question but I can't seem to get this to
work. As the title says i am trying to load an external js file and assign
it to a variable as plain text. The project is a simple js "compiler" that
stitches together a number of js files and minifies them into one.
The problem is that the js file that handles the above also needs to be
included in the final minified file. I can load in all the other files and
stitch them together just fine but when i load this main file into itself
sourcing a js file it seems to evaluate and overwrite itself and so stops
the process.
For the time being i have got around the problem by loading in a copy as a
.txt file but it means i have to keep two files up to date which isn't
ideal.
I found this article but it refers to javascript loaded via script tags in
the head.
Any help would be appreciated. I will happily post code but not sure which
bits would be useful.