Permalink
Browse files

Use ScriptReference in sample to simplify referencing knockout module

  • Loading branch information...
1 parent c5329ac commit be085818c1130201006f7fa9751e8e53da9e5f79 @nikhilk committed Oct 7, 2012
View
3 samples/KOWorld/App/Properties/AssemblyInfo.cs
@@ -17,6 +17,7 @@
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ScriptAssembly("app")]
+[assembly: ScriptReference("knockout", Path = "knockout-2.1.0")]
// A script template allows customization of the generated script.
[assembly: ScriptTemplate(@"
@@ -27,7 +28,7 @@
""use strict"";
-define('{name}', [{requires}], function({dependencies}) {
+require([{requires}], function({dependencies}) {
var $global = this;
{script}
View
8 samples/KOWorld/Web/Hello.html
@@ -13,13 +13,5 @@
<h2>Hello, <span data-bind="text: fullName"> </span>!</h2>
</fieldset>
<script data-main="Scripts/app" src="Scripts/require.min.js"></script>
- <script>
- require.config({
- paths: {
- knockout: 'http://cdnjs.cloudflare.com/ajax/libs/knockout/2.1.0/knockout-min'
- }
- });
- require(['app']);
- </script>
</body>
</html>
View
5 samples/KOWorld/Web/Web.csproj
@@ -19,6 +19,7 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
+ <RestoreNugetPackages>true</RestoreNugetPackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -51,6 +52,8 @@
<Content Include="Scripts\cs.js" />
<Content Include="Scripts\domReady.js" />
<Content Include="Scripts\i18n.js" />
+ <Content Include="Scripts\knockout-2.1.0.debug.js" />
+ <Content Include="Scripts\knockout-2.1.0.js" />
<Content Include="Scripts\r.js" />
<Content Include="Scripts\require.js" />
<Content Include="Scripts\require.min.js" />
@@ -60,6 +63,7 @@
<Content Include="Scripts\ssloader.min.js" />
<Content Include="Scripts\text.js" />
</ItemGroup>
+ <ItemGroup />
<ItemGroup>
<Content Include="packages.config" />
</ItemGroup>
@@ -70,6 +74,7 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
+ <Import Project="..\packages\nuget.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
View
1 samples/KOWorld/Web/packages.config
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="knockoutjs" version="2.1.0" targetFramework="net40" />
<package id="RequireJS" version="2.0.4.1" targetFramework="net40" />
<package id="ScriptSharp.Runtime" version="0.8" targetFramework="net40" />
</packages>

0 comments on commit be08581

Please sign in to comment.