This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathconfig.fsx
executable file
·46 lines (42 loc) · 1.83 KB
/
config.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#r "_lib/Fornax.Core.dll"
open Config
open System.IO
let postPredicate (projectRoot: string, page: string) =
let fileName = Path.Combine(projectRoot,page)
let ext = Path.GetExtension page
if ext = ".md" then
let ctn = File.ReadAllText fileName
ctn.Contains("layout: post")
else
false
let staticPredicate (projectRoot: string, page: string) =
let ext = Path.GetExtension page
if page.Contains "_public" ||
page.Contains "_bin" ||
page.Contains "_lib" ||
page.Contains "_data" ||
page.Contains "_settings" ||
page.Contains "_config.yml" ||
page.Contains ".sass-cache" ||
page.Contains ".git" ||
page.Contains ".ionide" ||
ext = ".fsx"
then
false
else
true
let config = {
Generators = [
{Script = "less.fsx"; Trigger = OnFileExt ".less"; OutputFile = ChangeExtension "css" }
{Script = "sass.fsx"; Trigger = OnFileExt ".scss"; OutputFile = ChangeExtension "css" }
{Script = "post.fsx"; Trigger = OnFilePredicate postPredicate; OutputFile = ChangeExtension "html" }
{Script = "staticfile.fsx"; Trigger = OnFilePredicate staticPredicate; OutputFile = SameFileName }
{Script = "index.fsx"; Trigger = Once; OutputFile = NewFileName "index.html" }
{Script = "about.fsx"; Trigger = Once; OutputFile = NewFileName "about.html" }
{Script = "docs.fsx"; Trigger = Once; OutputFile = NewFileName "docs.html" }
{Script = "install.fsx"; Trigger = Once; OutputFile = NewFileName "install.html" }
{Script = "community.fsx"; Trigger = Once; OutputFile = NewFileName "community.html" }
{Script = "foundation.fsx"; Trigger = Once; OutputFile = NewFileName "foundation.html" }
{Script = "contact.fsx"; Trigger = Once; OutputFile = NewFileName "contact.html" }
]
}