diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 191c3df..6508749 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,10 +5,12 @@ on: paths: - "src/**" - "public/**" + - ".github/workflows/ci.yml" pull_request: paths: - "src/**" - "public/**" + - ".github/workflows/ci.yml" jobs: ubuntu: runs-on: ubuntu-latest @@ -22,18 +24,14 @@ jobs: nimble install -d -y - name: Frontend - run: nimble frontend - - - name: Backend - run: nimble build + run: nimble htmlpage - name: Upload Artifacts uses: actions/upload-artifact@v4 with: name: ubuntu path: | - app - public + dist if-no-files-found: error # windows: diff --git a/grado.nimble b/grado.nimble index 5f7dd27..04b9a90 100644 --- a/grado.nimble +++ b/grado.nimble @@ -17,12 +17,33 @@ requires "prologue >= 0.6.4" requires "sass >= 0.2.0" requires "kdl >= 2.0.1" -task frontend, "Compiles the frontend to JavaScript and builds the CSS": +task css, "Builds the CSS": exec "nimble c -r --mm:refc src/buildcss" - exec "nim js --outdir:public/js src/frontend" task frontendjs, "Compiles the frontend to JavaScript": exec "nim js --outdir:public/js src/frontend" -task css, "Builds the CSS": - exec "nimble c -r --mm:refc src/buildcss" +task frontend, "Compiles the frontend to JavaScript and builds the CSS": + exec "nimble css" + exec "nim frontendjs" + +import std/strtabs +import src/config as _ + +task htmlpage, "Generates a single html page": + exec "nimble css" + exec "nim js -d:relativePath --out:dist/app.js src/frontend" + + mkDir "dist" + cpFile "public/css/style.css", "dist/style.css" + cpDir "public/img", "dist/img" + + writeFile "dist/index.html", readFile("public/karax.html") % + { + "title": config.title, + "frontend": "./app.js", + "style": "./style.css", + "favicon": "./img/favicon.ico" + # "timestamp": encodeUrl(CompileDate & CompileTime), + # "ga": config.ga + }.newStringTable() diff --git a/public/karax.html b/public/karax.html index 879cb3e..117ee82 100644 --- a/public/karax.html +++ b/public/karax.html @@ -9,7 +9,7 @@