nzbdrone now requires grunt to work.
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
|
||||
namespace NzbDrone.Api.FrontendModule
|
||||
{
|
||||
public class BootstrapModule : NancyModule
|
||||
{
|
||||
private readonly ICompileLess _lessCompiler;
|
||||
|
||||
public BootstrapModule(ICompileLess lessCompiler)
|
||||
{
|
||||
_lessCompiler = lessCompiler;
|
||||
Get[@"static/content/bootstrap/bootstrap.less"] = x => OnGet();
|
||||
}
|
||||
|
||||
private Response OnGet()
|
||||
{
|
||||
/* var urlParts = Request.Path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (urlParts.Length < 2)
|
||||
{
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
||||
urlParts[0] = "NzbDrone.Backbone";
|
||||
|
||||
var filePath = Path.Combine(urlParts);
|
||||
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
return new NotFoundResponse();
|
||||
}*/
|
||||
|
||||
var css = _lessCompiler.Compile(Path.Combine("NzbDrone.Backbone","Content","Bootstrap","bootstrap.less"));
|
||||
|
||||
return new TextResponse(HttpStatusCode.OK, css) { ContentType = "text/css" };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace NzbDrone.Api.FrontendModule
|
||||
}
|
||||
|
||||
|
||||
return View["NzbDrone.Backbone/index.html"];
|
||||
return View["UI/index.html"];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using dotless.Core;
|
||||
using dotless.Core.Importers;
|
||||
using dotless.Core.Input;
|
||||
using dotless.Core.Parser;
|
||||
|
||||
namespace NzbDrone.Api.FrontendModule
|
||||
{
|
||||
public interface ICompileLess
|
||||
{
|
||||
string Compile(string filePath);
|
||||
}
|
||||
|
||||
public class LessCompiler : ICompileLess
|
||||
{
|
||||
|
||||
public string Compile(string filePath)
|
||||
{
|
||||
var parser = new Parser()
|
||||
{
|
||||
Importer = new Importer(new LessFileReader(filePath))
|
||||
};
|
||||
|
||||
var lessEngine = new LessEngine(parser, null, false, true);
|
||||
var lessContent = File.ReadAllText(filePath);
|
||||
return lessEngine.TransformToCss(lessContent, filePath);
|
||||
}
|
||||
|
||||
|
||||
class LessFileReader : IFileReader
|
||||
{
|
||||
private readonly string _rootFolders;
|
||||
|
||||
public LessFileReader(string masterFile)
|
||||
{
|
||||
_rootFolders = new FileInfo(masterFile).Directory.FullName;
|
||||
}
|
||||
|
||||
public byte[] GetBinaryFileContents(string fileName)
|
||||
{
|
||||
return File.ReadAllBytes(Path.Combine(_rootFolders, fileName));
|
||||
}
|
||||
|
||||
public string GetFileContents(string fileName)
|
||||
{
|
||||
return File.ReadAllText(Path.Combine(_rootFolders, fileName));
|
||||
}
|
||||
|
||||
public bool DoesFileExist(string fileName)
|
||||
{
|
||||
return File.Exists(Path.Combine(_rootFolders, fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace NzbDrone.Api
|
||||
protected override void ConfigureConventions(NancyConventions nancyConventions)
|
||||
{
|
||||
base.ConfigureConventions(nancyConventions);
|
||||
Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("static", @"NzbDrone.Backbone", new string[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" }));
|
||||
Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("static", @"UI", new[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="dotless.ClientOnly">
|
||||
<HintPath>..\packages\DotlessClientOnly.1.3.1.0\lib\dotless.ClientOnly.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FluentValidation">
|
||||
<HintPath>..\packages\FluentValidation.3.4.6.0\lib\Net40\FluentValidation.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -106,8 +103,6 @@
|
||||
<Compile Include="Extensions\NancyJsonSerializer.cs" />
|
||||
<Compile Include="Extensions\Serializer.cs" />
|
||||
<Compile Include="FrontendModule\IndexModule.cs" />
|
||||
<Compile Include="FrontendModule\BootstrapModule.cs" />
|
||||
<Compile Include="FrontendModule\LessService.cs" />
|
||||
<Compile Include="Missing\MissingResource.cs" />
|
||||
<Compile Include="Missing\MissingModule.cs" />
|
||||
<Compile Include="Resolvers\EndTimeResolver.cs" />
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<packages>
|
||||
<package id="Autofac" version="3.0.1" targetFramework="net40" />
|
||||
<package id="AutoMapper" version="2.2.1" targetFramework="net40" />
|
||||
<package id="DotlessClientOnly" version="1.3.1.0" targetFramework="net40" />
|
||||
<package id="FluentValidation" version="3.4.6.0" targetFramework="net40" />
|
||||
<package id="Nancy" version="0.16.1" targetFramework="net40" />
|
||||
<package id="Nancy.Bootstrappers.Autofac" version="0.16.1" targetFramework="net40" />
|
||||
|
||||
Reference in New Issue
Block a user