Skip to content

Instantly share code, notes, and snippets.

View vadimi's full-sized avatar
🇺🇦

Vadim vadimi

🇺🇦
View GitHub Profile
@vadimi
vadimi / MvcTemplateBundle.cs
Last active August 29, 2015 14:07
New AngularJS template bundle
var options = new TemplateCompilerOptions
{
ModuleName = "myapp",
Prefix = "/",
Standalone = true
};
var bundle = new TemplateBundle("~/templates", options)
.Include("~/templates/template1.html", "~/templates/template2.html");
bundles.Add(bundle);
@Scripts.Render("~/templates")
angular.module('myapp', []).run(['$templateCache', function ($templateCache) {
$templateCache.put('/templates/template1.html', "template1");
$templateCache.put('/templates/template2.html', "template2");
}]);
Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/MsBuild/2003" DefaultTargets="BuildBundles">
<UsingTask TaskName="AngularTemplates.Compile.AngularTemplatesTask"
AssemblyFile="..\packages\AngularTemplates.Compile.1.0.0\lib\net40\AngularTemplates.Compile.dll" />
<Target Name="BuildBundles">
<ItemGroup>
<Templates Include="$(ProjectDir)Scripts\templates\*.html;"/>
</ItemGroup>
@vadimi
vadimi / FindInEnumeration.xml
Created May 13, 2013 23:22
Simple MSBuild task to find items in ItemGroup
<UsingTask TaskName="FindInEnumeration" TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SourceFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<Result ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.Core" />
<UsingTask TaskName="ExcludeFromManifest" TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<ManifestPath ParameterType="System.String" Required="true" />
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Target Name="BeforeLayout" Condition="'$(Configuration)'=='Release'">
<FindInEnumeration Files="@(ExcludedFiles)" SourceFiles="@(EnumeratedFiles)">
<Output ItemName="Result" TaskParameter="Result" />
</FindInEnumeration>
<ItemGroup>
<EnumeratedFiles Remove="@(Result)"/>
</ItemGroup>
</Target>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ScriptsDir>Layouts\MyCoolProject\Scripts</ScriptsDir>
<ManifestPath>pkg\Release\MyCoolProject</ManifestPath>
</PropertyGroup>
<ItemGroup>
<ExcludedFiles Include="
$(ScriptsDir)\jquery-1.9.1.js;
$(ScriptsDir)\backbone.js;
$(ScriptsDir)\backbone-sharepoint.extensions.js;
<Target Name="AfterLayout" Condition="'$(Configuration)'=='Release'">
<ExcludeFromManifest Files="@(ExcludedFiles)" ManifestPath="$(ManifestPath)" />
</Target>
App = Ember.Application.create({
LOG_TRANSITIONS: true,
rootElement: '#main',
ready: function () {
// disable SP 2013 hashchange event handling
_spBodyOnHashChange = function () { };
}
});