Esempio n. 1
0
        private MinifiedFile AddCSHtmlToConfigFileAsync(DocumentNode document, string fullName, string relativePath)
        {
            if (!File.Exists(Path.ChangeExtension(fullName, "edit.cshtml")))
            {
                document = document.ChangeExtension("edit.cshtml");

                var parent = document.GetParent();

                if (parent is ProjectNode project)
                {
                    project.CreateDocument(fullName);
                }
                else
                {
                    var folderNode = (FolderNode)parent;

                    project = document.GetParentProject();

                    project.CreateDocument(folderNode, fullName);
                }
            }

            var newPath = Path.ChangeExtension(relativePath, "edit.cshtml");

            return(new CsHtmlMinifiedFile
            {
                OutputFile = relativePath,
                UsePreMailer = false,
                SourceFile = newPath
            });
        }