parent
3b22c087c6
commit
1c04a670d9
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
Loading…
Reference in new issue