1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- # Package
- import htmlgen
- version = "0.1.0"
- author = "Augusto Rivera"
- description = "A template to build websites using react.nim and purecss."
- license = "GPL-3.0"
- srcDir = "src"
- bin = @["purecss_react_nim"]
- # Dependencies
- requires "nim >= 1.0.0", "react >= 0.1.2", "jester >= 0.4.3"
- task clean, "Clean generated files.":
- if dirExists("public"):
- rmDir("public")
- rmFile("getassets")
- if fileExists(bin[0]):
- rmFile(bin[0])
- task getAssets, "Install frontend assets.":
- echo "Building index.html and getting external assets ..."
- let indexFile = "index.html"
- var indexHtml = "<!DOCTYPE html>"
- indexHtml.add(
- html(
- head(
- meta(charset="utf-8"),
- meta(name="viewport", content="width=device-width, initial-scale=1.0"),
- title("React, Nim, Pure.css Template"),
- link(rel="stylesheet", href="css/pure-min.css"),
- link(rel="stylesheet", href="css/marketing.css"),
- script(src="js/react.js"),
- script(src="js/react-dom.js"),
- script(src="js/app.js")
- ),
- body(onload="startApp()",
- `div`(id="root", class="container")
- )
- )
- )
- if not fileExists "getassets":
- exec "nimble c src/getassets.nim -d:ssl -o:./getassets"
- exec "./getassets"
- echo "Downloaded assets."
- withDir "public":
- if not fileExists(indexFile):
- writeFile(indexFile, indexHtml)
- task buildFrontend, "Build frontend files.":
- if not dirExists("public"):
- getAssetsTask()
-
- exec "nim js --o:public/js/app.js src/client/app.nim"
|