Created
October 5, 2012 14:36
-
-
Save dotnetchris/3840134 to your computer and use it in GitHub Desktop.
Tweaked Cassette.targets file for working with web deploy and Cassette.MSBuild
This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<!-- | |
The web application csproj file has been modified to import this file. | |
So after a build, the Cassette bundles will be saved into a cache directory. | |
--> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<UsingTask AssemblyFile="$(OutputPath)\Cassette.MSBuild.dll" TaskName="CreateBundles"/> | |
<PropertyGroup> | |
<!--<CassetteOutputPath Condition="'$(CassetteOutputPath)' == ''">Content/cassette-cache</CassetteOutputPath>--> | |
<!--<CopyAllFilesToSingleFolderForPackageDependsOn> | |
CollectCassetteCacheForDeploymentPackage; | |
$(CopyAllFilesToSingleFolderForPackageDependsOn); | |
</CopyAllFilesToSingleFolderForPackageDependsOn>--> | |
</PropertyGroup> | |
<Target Name="CleanBundle"> | |
<Error Text="CassetteOutputPath is not been set!" Condition="'$(CassetteOutputPath)' == ''" /> | |
<RemoveDir Directories="$(CassetteOutputPath)" Condition="Exists('$(CassetteOutputPath)')" /> | |
</Target> | |
<Target Name="Bundle" DependsOnTargets="CleanBundle"> | |
<Error Text="CassetteOutputPath is not been set!" Condition="'$(CassetteOutputPath)' == ''" /> | |
<MakeDir Directories="$(CassetteOutputPath)"/> | |
<CreateBundles Output="$(CassetteOutputPath)" /> | |
<!-- | |
CreateBundles has the following optional properties: | |
Source: The root directory of the web application. | |
Bin: The directory containing the web application assemblies. Default is "bin". | |
Output: The directory to save the created bundles to. Default is "cassette-cache". | |
IncludeOtherFiles: When true, non-bundled files such as images referenced by stylesheets are also copied to the output directory. Default is false. | |
The Web.config must also have the following section: | |
<cassette cacheDirectory="cassette-cache" /> | |
--> | |
</Target> | |
<!-- This target will be executed when MSBuild is building the package for a deployment. --> | |
<!--<Target Name="CollectCassetteCacheForDeploymentPackage" DependsOnTargets="Bundle"> | |
--><!-- Copy minified JavaScript files --><!-- | |
<ItemGroup> | |
<CassetteCacheItems Include="$(CassetteOutputDir)\**\*.*" /> | |
<FilesForPackagingFromProject Include="%(CassetteCacheItems.Identity)"> | |
<DestinationRelativePath>Content\cassette-cache\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> | |
</FilesForPackagingFromProject> | |
</ItemGroup> | |
</Target>--> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment