-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.hs
More file actions
72 lines (56 loc) · 2.54 KB
/
Build.hs
File metadata and controls
72 lines (56 loc) · 2.54 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
import Control.Monad
main :: IO ()
main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
want ["usemin"]
"clean" ~> do
unit $ cmd "rm -r build HTML hakyll/css"
"pull" ~> do
putNormal "Pulling from github"
cmd "git pull"
"css-from-less" ~> do
-- need ["pull"]
putNormal "Generating CSS files"
need [".bootstrap_less"]
need [".bootstrap_custom_variables_less"]
need [".custom_less"]
unit $ cmd "npm install"
unit $ cmd "node_modules/.bin/grunt less"
".bootstrap_less" ~> copyFiles "node_modules/bootstrap/less" "build/stylesheets/less"
".bootstrap_custom_variables_less" ~> copyRenameFile "node_modules/bootstrap/less/variables.less" "build/stylesheets/less/original-variables.less"
".custom_less" ~> copyFiles "frontend/less" "build/stylesheets/less"
"HTML" ~> do
need ["css-from-less"]
need [".fullpage_css"]
putNormal "Generating HTML files"
unit $ cmd (Cwd "hakyll") "stack build"
unit $ cmd (Cwd "hakyll") "stack exec site rebuild"
need [".bootstrap_fonts", ".fontawesome_fonts"]
need [".jquery_js", ".bootstrap_js", ".jquery_easing_js", ".fullpage_js"]
"usemin" ~> do
need ["HTML"]
unit $ cmd "node_modules/.bin/grunt -v optimize"
copyFiles "dist" "HTML"
".bootstrap_fonts" ~> copyFiles "node_modules/bootstrap/dist/fonts" "HTML/fonts"
".fontawesome_fonts" ~> copyFiles "node_modules/font-awesome/fonts" "HTML/fonts"
".fullpage_css" ~> copyFile "node_modules/fullpage.js" "jquery.fullPage.css" "hakyll/css"
".jquery_js" ~> copyFile "node_modules/jquery/dist" "jquery.min.js" "HTML/js"
".bootstrap_js" ~> copyFile "node_modules/bootstrap/dist/js" "bootstrap.min.js" "HTML/js"
".jquery_easing_js" ~> copyFile "node_modules/jquery.easing" "jquery.easing.min.js" "HTML/js"
".fullpage_js" ~> copyFile "node_modules/fullpage.js" "jquery.fullPage.js" "HTML/js"
copyRenameFile from to = do
copyFile' from to
copyFile from filename to = do
unit $ cmd "mkdir -p" to
copyFile' (from </> filename) (to </> filename)
copyFiles from to = do
unit $ cmd "mkdir -p" to
dirs <- getDirectoryDirs from
forM_ dirs $ \dir -> do
copyFiles (from </> dir) (to </> dir)
files <- getDirectoryFiles from ["*"]
forM_ files $ \file -> do
copyFile' (from </> file) (to </> file)