示例#1
0
 private ILessEngine GetEngine()
 {
     var importer = new Importer(new FileReader(new CustomPathResolver(filePath)));
     var parser = new Parser(new PlainStylizer(), importer);
     var engine = new LessEngine(parser);
     return engine;
 }
示例#2
0
 private ILessEngine GetEngine()
 {
     var importer = new Importer(new CustomFileReader(fileSystem, filePath));
     var parser = new Parser(new PlainStylizer(), importer);
     var engine = new LessEngine(parser) { Compress = true };
     return engine;
 }
示例#3
0
		ILessEngine CreateLessEngine(string path)
		{
			var importer = new Importer(new MulderFileReader(fileSystem, path));
			var parser = new Parser(new PlainStylizer(), importer);
			var engine = new LessEngine(parser) { Compress = true };
			return engine;
		}
示例#4
0
 private ILessEngine GetLessEngine(string physicalPath)
 {
     var basePath = Path.GetDirectoryName(physicalPath);
     var stylizer = new PlainStylizer();
     var importer = new Importer(new FileReader(new BasePathResolver(basePath)));
     var parser = new Parser(stylizer, importer) { NodeProvider = new RawUrlNodeProvider() };
     var lessEngine = new LessEngine(parser);
     return lessEngine;
 }
        public ILessEngine GetEngine(IFileSystem fileSystem, string directory)
        {
            IStylizer stylizer = new HtmlStylizer();

            IPathResolver pathResolver = new TestPathResolver(directory);
            IFileReader reader = new TestFileReader(fileSystem, pathResolver);
            var importer = new Importer(reader);
            var parser = new Parser(stylizer, importer);
            ILogger logger = new ConsoleLogger(LogLevel.Error);
            return new LessEngine(parser, logger, true, true);
        }
示例#6
0
            public static string Generate(string fileName, string less, string color1, string color2)
            {
                var reader = new CustomFileReader(color1, color2);
                var importer = new Importer(reader);
                var parser = new Parser(new PlainStylizer(), importer, false);
                var lessEngine = new LessEngine(parser, NullLogger.Instance, true, false);
                less = Regex.Replace(less, "\\.theme-color\\(([a-z-]+),? ?", Evaluate);

                lessEngine.CurrentDirectory = Path.GetDirectoryName(fileName);

                return lessEngine.TransformToCss(less, Path.GetFileName(fileName));
            }
示例#7
0
        protected override string ReadFileContent(string fileSystemPath, bool minify)
        {
            var directory = Path.GetDirectoryName(fileSystemPath);
            var pathResolver = new AbsolutePathResolver(directory);
            var fileReader = new FileReader { PathResolver = pathResolver };
            var importer = new Importer { FileReader = fileReader };
            var parser = new Parser { Importer = importer };
            var lessEngine = new LessEngine { Parser = parser };

            var rawFileContent = base.ReadFileContent(fileSystemPath, false);

            return lessEngine.TransformToCss(rawFileContent, fileSystemPath);
        }
示例#8
0
 public ImportScope(Importer importer, string path)
 {
     this.importer = importer;
     this.importer._paths.Add(path);
 }
示例#9
0
 public ImportScope(Importer importer, string path)
 {
     this.importer = importer;
     this.importer._paths.Add(path);
 }