private void Compile()
        {
            var options = new TemplateCompilerOptions
            {
                OutputPath = OutputFile,
                Prefix = Prefix,
                ModuleName = ModuleName,
                WorkingDir = WorkingDir,
                Standalone = Standalone,
                LowercaseTemplateName = LowercaseTemplateName
            };

            var compiler = new TemplateCompiler(options);
            var files = SourceFiles.Select(f => new FileInfoVirtualFile(f.ItemSpec, new FileInfo(f.ItemSpec))).ToArray();
            compiler.CompileToFile(files);
            
            Log.LogMessage("Compiled {0} templates to {1}", SourceFiles.Length, OutputFile);
        }
        public TemplateCompiler(TemplateCompilerOptions options)
        {
            _options = options;
            _baseUrl = string.Empty;
            if (!string.IsNullOrWhiteSpace(options.Prefix))
            {
                _baseUrl = options.Prefix;
                if (!_baseUrl.EndsWith("/"))
                {
                    _baseUrl += "/";
                }
            }

            _moduleName = string.IsNullOrWhiteSpace(options.ModuleName) ? DefaultModuleName : options.ModuleName;
            _workingDir = string.IsNullOrWhiteSpace(options.WorkingDir)
                ? Environment.CurrentDirectory
                : Path.GetFullPath(options.WorkingDir);
        }
Exemple #3
0
        private void Compile()
        {
            var options = new TemplateCompilerOptions
            {
                OutputPath            = OutputFile,
                Prefix                = Prefix,
                ModuleName            = ModuleName,
                WorkingDir            = WorkingDir,
                Standalone            = Standalone,
                LowercaseTemplateName = LowercaseTemplateName
            };

            var compiler = new TemplateCompiler(options);
            var files    = SourceFiles.Select(f => new FileInfoVirtualFile(f.ItemSpec, new FileInfo(f.ItemSpec))).ToArray();

            compiler.CompileToFile(files);

            Log.LogMessage("Compiled {0} templates to {1}", SourceFiles.Length, OutputFile);
        }
 public TemplateBundle(string virtualPath, string cdnPath, TemplateCompilerOptions options)
     : base(virtualPath, cdnPath)
 {
     _options = options;
 }