-
-
Save shortbloke/de13dd33c0b12409353a3116dd8ce84c to your computer and use it in GitHub Desktop.
Statiq Pipelines
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
using Statiq.Minification; | |
namespace HighlightHelp.pipelines | |
{ | |
public class JavaScript : Pipeline | |
{ | |
public JavaScript() | |
{ | |
InputModules = new ModuleList | |
{ | |
new ReadFiles("help/**/*.js") | |
}; | |
PostProcessModules = new ModuleList | |
{ | |
new MinifyJs(), | |
new SetDestination(".js") | |
}; | |
OutputModules = new ModuleList | |
{ | |
new WriteFiles() | |
}; | |
} | |
} | |
} |
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
using Statiq.Minification; | |
namespace HighlightHelp | |
{ | |
class Program | |
{ | |
public static async Task<int> Main(string[] args) => | |
await Bootstrapper | |
.Factory | |
.CreateWeb(args) | |
/* ** HACK ** Clearing the file list for all the standard pipelines. | |
* Was unable to get existing piplines to minifi JS or HTML without acting on the wrong file types | |
* Was unable to stop analyzers - All the links were generating relative link errors. | |
*/ | |
.AddSetting(WebKeys.InputFiles, "") | |
//.ModifyPipeline(nameof(Statiq.Web.Pipelines.Assets), p => p.PostProcessModules.Add(new MinifyJs())) | |
//.AddSetting(Keys.ValidateRelativeLinks, false) | |
.RunAsync(); | |
} | |
} |
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
using HighlightHelp.Modules.HLTemplate; | |
using Statiq.Minification; | |
using Statiq.Razor; | |
using Statiq.Yaml; | |
namespace HighlightHelp.pipelines | |
{ | |
public class RazorPages : Pipeline | |
{ | |
public RazorPages() | |
{ | |
InputModules = new ModuleList | |
{ | |
new ReadFiles("help/**/{!_,}*.cshtml") | |
}; | |
ProcessModules = new ModuleList | |
{ | |
new ExtractFrontMatter(new ParseYaml()), | |
new HLTemplate(), | |
new RenderRazor(), | |
new SetDestination(".html") | |
}; | |
PostProcessModules = new ModuleList | |
{ | |
new MinifyHtml() | |
}; | |
OutputModules = new ModuleList | |
{ | |
new WriteFiles() | |
}; | |
} | |
} | |
} |
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
namespace HighlightHelp.pipelines | |
{ | |
public class Resources : Pipeline | |
{ | |
public Resources() | |
{ | |
InputModules = new ModuleList | |
{ | |
new ReadFiles() | |
}; | |
ProcessModules = new ModuleList | |
{ | |
// Images | |
new CopyFiles("help/**/*.{png,gif,svg,jpg}"), | |
// Documents | |
new CopyFiles("help/**/*.pdf"), | |
new CopyFiles("help/**/*.xl{t,s}x"), | |
// Other | |
new CopyFiles("**/*web.config"), | |
new CopyFiles("help/favicon.ico") | |
}; | |
} | |
} | |
} |
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
using Statiq.Sass; | |
namespace HighlightHelp.pipelines | |
{ | |
public class Sass : Pipeline | |
{ | |
public Sass() | |
{ | |
InputModules = new ModuleList | |
{ | |
new ReadFiles("help/styles/main.scss") | |
}; | |
ProcessModules = new ModuleList | |
{ | |
new CompileSass() | |
.GenerateSourceMap() | |
.WithCompressedOutputStyle() | |
}; | |
OutputModules = new ModuleList | |
{ | |
new WriteFiles() | |
}; | |
} | |
} | |
} |
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
using Statiq.Lunr; | |
namespace HighlightHelp.pipelines | |
{ | |
public class SearchIndex : Pipeline | |
{ | |
public SearchIndex() | |
{ | |
Dependencies.AddRange(nameof(RazorPages)); | |
PostProcessModules = new ModuleList | |
{ | |
new ReplaceDocuments(nameof(RazorPages)), | |
new GenerateLunrIndex() | |
.WithField("Description", FieldType.Result) | |
.WithField("Tags", FieldType.Result) | |
.WithClientName("searchModule") | |
.WithStopWordsFromFile("StopWords.txt") | |
.WithScriptPath("help/scripts/searchindex.js") | |
.ZipResultsFile(false) | |
}; | |
OutputModules = new ModuleList | |
{ | |
new WriteFiles() | |
}; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment