Skip to content

Instantly share code, notes, and snippets.

@johnkingzy
Created February 19, 2018 23:15
Show Gist options
  • Save johnkingzy/a4e55d0d18ee91582cd0d785015d2b36 to your computer and use it in GitHub Desktop.
Save johnkingzy/a4e55d0d18ee91582cd0d785015d2b36 to your computer and use it in GitHub Desktop.
//js scripts replace regex
var jsSearch = /{{ — angular scripts begin — }}[\s\S]*{{ — angular scripts end — }}/;
var jsReplaceStr =
“{{ — angular scripts begin — }}” +
“\n\t\t” +
scripts.join(“\n\t\t”) +
“\n\t\t{{ — angular scripts end — }}”;
//css styles replace regex
var cssSearch = /{{ — angular styles begin — }}[\s\S]*{{ — angular styles end — }}/;
var cssReplaceStr =
“{{ — angular styles begin — }}” +
“\n\t\t” +
styles.join(“\n\t\t”) +
“\n\t\t{{ — angular styles end — }}”;
//replace app stylesheet links and js script tags with new ones
var content = fs.readFileSync(
“./../server/resources/views/welcome.blade.php”,
“utf8”
);
content = content
.replace(jsSearch, jsReplaceStr)
.replace(cssSearch, cssReplaceStr);
fs.writeFileSync(
“./../server/resources/views/welcome.blade.php”,
content,
“utf8”
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment