-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added support of @import directives in sass * Fixed multi-level import * Fix typo
- Loading branch information
1 parent
b718191
commit 87767d9
Showing
4 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using LibSassHost; | ||
|
||
namespace VirtoCommerce.LiquidThemeEngine | ||
{ | ||
public interface ISassFileManager: IFileManager | ||
{ | ||
string CurrentDirectory { get; set; } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.IO; | ||
using LibSassHost; | ||
using VirtoCommerce.Storefront.Model; | ||
using VirtoCommerce.Storefront.Model.Common; | ||
using VirtoCommerce.Storefront.Model.StaticContent; | ||
|
||
namespace VirtoCommerce.LiquidThemeEngine | ||
{ | ||
public class SassFileManager: ISassFileManager | ||
{ | ||
private readonly IContentBlobProvider _contentBlobProvider; | ||
|
||
public bool SupportsConversionToAbsolutePath { get; } = false; | ||
|
||
public string CurrentDirectory { get; set; } | ||
|
||
public SassFileManager(IContentBlobProvider contentBlobProvider) | ||
{ | ||
_contentBlobProvider = contentBlobProvider; | ||
} | ||
|
||
public string GetCurrentDirectory() => CurrentDirectory; | ||
|
||
public bool FileExists(string path) | ||
{ | ||
// Workaround for directories | ||
if (string.IsNullOrEmpty(Path.GetExtension(path))) | ||
{ | ||
return false; | ||
} | ||
return _contentBlobProvider.PathExists(path); | ||
} | ||
|
||
public bool IsAbsolutePath(string path) | ||
{ | ||
return Path.GetDirectoryName(path).StartsWith(CurrentDirectory); | ||
} | ||
|
||
public string ToAbsolutePath(string path) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public string ReadFile(string path) | ||
{ | ||
return _contentBlobProvider.OpenRead(path).ReadToString(); | ||
} | ||
} | ||
} |
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
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