Skip to content

Commit

Permalink
Move Sass support to its own library. Clean up the build for NET35.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdavey committed Mar 16, 2012
1 parent d9b7860 commit fdb856d
Show file tree
Hide file tree
Showing 37 changed files with 247 additions and 122 deletions.
Expand Up @@ -158,6 +158,10 @@
<Project>{F8ED179C-E38B-4EF4-A5E8-52AC1611425E}</Project>
<Name>Cassette.MSBuild</Name>
</ProjectReference>
<ProjectReference Include="..\Cassette.Sass\Cassette.Sass.csproj" Condition="'$(TargetFrameworkVersion)' == 'v4.0'">
<Project>{52B1448C-8165-46B7-B024-A6BF9F60D766}</Project>
<Name>Cassette.Sass</Name>
</ProjectReference>
<ProjectReference Include="..\Cassette.Web\Cassette.Web.csproj">
<Project>{733F8032-D649-4E4C-A23E-4A048C33FCAE}</Project>
<Name>Cassette.Web</Name>
Expand All @@ -181,4 +185,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
21 changes: 13 additions & 8 deletions src/Cassette.IntegrationTests/CassetteApplication.cs
Expand Up @@ -61,29 +61,26 @@ public void CanGetScriptBundleB()
}
}

#if !NET35
[Fact]
public void CanGetStylesheetBundleA()
{
using (CreateApplication(bundles => bundles.AddPerSubDirectory<StylesheetBundle>("Styles")))
using (CreateApplication(bundles => bundles.AddPerSubDirectory<StylesheetBundle>("Styles", b => b.Processor = new StylesheetPipeline().CompileSass())))
{
using (var http = new HttpTestHarness(routes))
{
http.Get("~/_cassette/stylesheetbundle/styles/bundle-a");
#if NET35
http.ResponseOutputStream.ReadToEnd().ShouldEqual("color: red;a{color:$color}p{border:1px solid red}body{color:#abc}");
#endif
#if NET40
http.ResponseOutputStream.ReadToEnd().ShouldEqual("a{color:red}p{border:1px solid red}body{color:#abc}");
#endif
}
}
}
#endif

#if NET40
#if !NET35
[Fact]
public void CanGetStylesheetBundleB()
{
using (CreateApplication(bundles => bundles.AddPerSubDirectory<StylesheetBundle>("Styles")))
using (CreateApplication(bundles => bundles.AddPerSubDirectory<StylesheetBundle>("Styles", b => b.Processor = new StylesheetPipeline().CompileSass())))
{
using (var http = new HttpTestHarness(routes))
{
Expand All @@ -93,6 +90,7 @@ public void CanGetStylesheetBundleB()
}
}
#endif

[Fact]
public void GivenDebugMode_ThenCanGetAsset()
{
Expand Down Expand Up @@ -227,10 +225,17 @@ void RemoveExistingCache()
{
using (var storage = IsolatedStorageFile.GetMachineStoreForAssembly())
{
#if NET35
if (storage.GetFileNames("casette.xml").Length > 0)
{
storage.DeleteFile("cassette.xml");
}
#else
if (storage.FileExists("cassette.xml"))
{
storage.DeleteFile("cassette.xml");
}
#endif
}
}

Expand Down
22 changes: 20 additions & 2 deletions src/Cassette.JQueryTmpl/Cassette.JQueryTmpl.csproj
Expand Up @@ -31,12 +31,30 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-FX35|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug-FX35\</OutputPath>
<DefineConstants>DEBUG;TRACE;NET35</DefineConstants>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-FX35|AnyCPU'">
<OutputPath>bin\Release-FX35\</OutputPath>
<DefineConstants>TRACE;NET35</DefineConstants>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Jurassic">
<HintPath>..\packages\Jurassic.2.1.1\lib\Jurassic.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp" Condition="'$(TargetFrameworkVersion)' == 'v4.0'" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
Expand Down Expand Up @@ -76,4 +94,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
27 changes: 20 additions & 7 deletions src/Cassette.KnockoutJQueryTmpl/Cassette.KnockoutJQueryTmpl.csproj
Expand Up @@ -30,17 +30,30 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-FX35|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug-FX35\</OutputPath>
<DefineConstants>DEBUG;TRACE;NET35</DefineConstants>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-FX35|AnyCPU'">
<OutputPath>bin\Release-FX35\</OutputPath>
<DefineConstants>TRACE;NET35</DefineConstants>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Jurassic">
<HintPath>..\packages\Jurassic.2.1.1\lib\Jurassic.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" Condition="'$(TargetFrameworkVersion)' == 'v4.0'" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
Expand Down Expand Up @@ -86,4 +99,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
1 change: 1 addition & 0 deletions src/Cassette.Less/Cassette.Less.csproj
Expand Up @@ -177,6 +177,7 @@
<Compile Include="dotless\Core\Utils\StringExtensions.cs" />
<Compile Include="LessCompileException.cs" />
<Compile Include="LessCompiler.cs" />
<Compile Include="ParseLessReferences.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StylesheetPipelineExtensions.cs" />
</ItemGroup>
Expand Down
File renamed without changes.
93 changes: 93 additions & 0 deletions src/Cassette.Sass/Cassette.Sass.csproj
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{52B1448C-8165-46B7-B024-A6BF9F60D766}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cassette.Stylesheets</RootNamespace>
<AssemblyName>Cassette.Sass</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="IronRuby">
<HintPath>..\packages\IronRuby.1.1.3\Lib\IronRuby.dll</HintPath>
</Reference>
<Reference Include="IronRuby.Libraries">
<HintPath>..\packages\IronRuby.1.1.3\Lib\IronRuby.Libraries.dll</HintPath>
</Reference>
<Reference Include="IronRuby.Libraries.Yaml">
<HintPath>..\packages\IronRuby.1.1.3\Lib\IronRuby.Libraries.Yaml.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Dynamic, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\IronRuby.1.1.3\Lib\Microsoft.Dynamic.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\IronRuby.1.1.3\Lib\Microsoft.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.Metadata">
<HintPath>..\packages\IronRuby.1.1.3\Lib\Microsoft.Scripting.Metadata.dll</HintPath>
</Reference>
<Reference Include="SassAndCoffee.Core">
<HintPath>..\packages\SassAndCoffee.Core.2.0.2.0\lib\net40-Client\SassAndCoffee.Core.dll</HintPath>
</Reference>
<Reference Include="SassAndCoffee.Ruby">
<HintPath>..\packages\SassAndCoffee.Ruby.2.0.2.0\lib\net40-Client\SassAndCoffee.Ruby.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="CassettePlatformAdaptationLayer.cs" />
<Compile Include="CompileSass.cs" />
<Compile Include="ParseSassReferences.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SassCompiler.cs" />
<Compile Include="StylesheetPipelineExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cassette\Cassette.csproj">
<Project>{A5CCF9D3-5D49-4BFC-B9A6-9EC9E0E29C50}</Project>
<Name>Cassette</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,4 +1,4 @@
#if NET40
#if !NET35
using System;
using System.IO;
using Cassette.IO;
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions src/Cassette.Sass/Properties/AssemblyInfo.cs
@@ -0,0 +1,18 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cassette.Sass")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6fe9ed52-cc13-4412-bdb4-eb0321191408")]

[assembly: InternalsVisibleTo("Cassette.UnitTests")]
@@ -1,4 +1,4 @@
#if NET40
#if !NET35

using System;
using System.Collections.Generic;
Expand Down
17 changes: 17 additions & 0 deletions src/Cassette.Sass/StylesheetPipelineExtensions.cs
@@ -0,0 +1,17 @@
using Cassette.BundleProcessing;

namespace Cassette.Stylesheets
{
public static class StylesheetPipelineExtensions
{
public static T CompileSass<T>(this T pipeline)
where T : MutablePipeline<StylesheetBundle>
{
pipeline.InsertAfter<ParseCssReferences>(
new ParseSassReferences(),
new CompileSass(new SassCompiler())
);
return pipeline;
}
}
}
6 changes: 6 additions & 0 deletions src/Cassette.Sass/packages.config
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="IronRuby" version="1.1.3" />
<package id="SassAndCoffee.Core" version="2.0.2.0" />
<package id="SassAndCoffee.Ruby" version="2.0.2.0" />
</packages>
2 changes: 1 addition & 1 deletion src/Cassette.UnitTests/BundleProcessing/AssignHash.cs
Expand Up @@ -79,7 +79,7 @@ void AssertHashIsSha1Of(string expected)

void IDisposable.Dispose()
{
#if NET40
#if !NET35
sha1.Dispose();
#endif
}
Expand Down
8 changes: 6 additions & 2 deletions src/Cassette.UnitTests/Cassette.UnitTests.csproj
Expand Up @@ -177,7 +177,7 @@
<Compile Include="Scripts\ScriptBundle.cs" />
<Compile Include="StubAsset.cs" />
<Compile Include="Stylesheets\AssignStylesheetRenderer.cs" />
<Compile Include="Stylesheets\CompileSass.cs" />
<Compile Include="Stylesheets\CompileSass.cs" Condition="'$(TargetFrameworkVersion)' == 'v4.0'" />
<Compile Include="Stylesheets\CssCommentParser.cs" />
<Compile Include="Stylesheets\LessCompiler.cs" />
<Compile Include="Stylesheets\Manifests\ExternalStylesheetBundleManifest.cs" />
Expand Down Expand Up @@ -275,6 +275,10 @@
<Project>{F8ED179C-E38B-4EF4-A5E8-52AC1611425E}</Project>
<Name>Cassette.MSBuild</Name>
</ProjectReference>
<ProjectReference Condition="'$(TargetFrameworkVersion)' == 'v4.0'" Include="..\Cassette.Sass\Cassette.Sass.csproj">
<Project>{52B1448C-8165-46B7-B024-A6BF9F60D766}</Project>
<Name>Cassette.Sass</Name>
</ProjectReference>
<ProjectReference Include="..\Cassette.Views\Cassette.Views.csproj">
<Project>{3A021487-A395-4FE6-9B41-336D0F1E6AD0}</Project>
<Name>Cassette.Views</Name>
Expand All @@ -301,4 +305,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Cassette.UnitTests/IO/IsolatedStorageFileWrapper.cs
Expand Up @@ -57,7 +57,7 @@ public void DirectoryReturnsDirectoryPassedToConstructor()

// According to andrew, LastWriteTime is actually never really called in
// code, so we should be able to safely ignore it (for FX35)
#if NET40
#if !NET35
[Fact]
public void GetLastWriteTimeUtcReturnsFileWriteTime()
{
Expand Down

0 comments on commit fdb856d

Please sign in to comment.