Created
December 17, 2014 16:02
-
-
Save Ephasme/d3091565d092290dcb9d to your computer and use it in GitHub Desktop.
LoadScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void LoadScript(string scriptName) { | |
| var key = string.Format("js.scripts.{0}", scriptName); | |
| if (Page.Items.Contains(key) && (bool)Page.Items[key]) return; | |
| var builder = new StringBuilder(); | |
| using (var sr = new StreamReader(new FileStream(MapPath(string.Format("../JS/{0}.min.js", scriptName)), FileMode.Open, FileAccess.Read))) { | |
| builder.Append(sr.ReadToEnd()); | |
| AddScriptBlock(builder.ToString()); | |
| Page.Items.Add(key, true); | |
| sr.Close(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment