|« Previous article:||Next article: »|
|Solid Buzzfuzz||Blog Home||Event Source Base class for Typescript|
Well, it’s grown a bit since then. First, the new, more appropriate name, and now it’s easily installable via NuGet (under the id “
Plus there are a few new features, and I suspect there are people hearing about
Wouldn’t it be great if there was some labor-saving device that could make that simple?
At the top of your layout, add:
Then, where you want the CSS files, remove the line:
Where you want the JS files, remove the lines
@Scripts.Render("~/bundles/jquery") @RenderSection("scripts", required: false)
Then in you views, add (for example)
self” refers to a JS file following the same naming conventions as the view template, under the Scripts folder
The other names (“
slider” etc) refer to JS files defined in the jslibraries.xml in the website root.
~/jslibraries.xml file needs to be manually updated for the JS files you are using, but once you get it the way you like, you can copy it from project to project. (A basic one, covering the files used in Wizard-created projects is included).
mapping”, and it gives you
ko.mapping-latest.js and also
knockout-3.0.0.js. And when v3.1 comes out, just update it once in the jslibraries file, and the new version is used everywhere. (I look forward to a world where authors include updating the jslibraries file as part of their NuGet package.)
Plus, if any of these files you asked for needs a CSS file, it’s included too (because you always forget to add them, right?)
What to always use the full versions of scripts during development, then switch to the minified versions for production? Change one setting in the jslibraries.xml file. How ‘bout turning on MVC’s bundling & minification – yep, change just one setting in the xml file.
More detailed (if a bit outdated) information is available on the CodeProject article I wrote on it.