Adds ability to override CSS styles from a foreign repo.
This commit is contained in:
parent
375391ae99
commit
705f212118
9 changed files with 41 additions and 18 deletions
|
|
@ -6,6 +6,7 @@ $label-color: #7cd2ff;
|
||||||
$secondary-btn-color: #f1f1f1;
|
$secondary-btn-color: #f1f1f1;
|
||||||
|
|
||||||
// Define nav bar colours.
|
// Define nav bar colours.
|
||||||
|
$body-bg: #ffffff;
|
||||||
$navbar-color: $body-bg;
|
$navbar-color: $body-bg;
|
||||||
$navbar-border-color-dark: $body-bg;
|
$navbar-border-color-dark: $body-bg;
|
||||||
$navbar-primary-color: #e80080;
|
$navbar-primary-color: #e80080;
|
||||||
BIN
localhost.local/public/images/logo.png
Normal file
BIN
localhost.local/public/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -33,7 +33,7 @@ task runbackend, "Runs the forum backend":
|
||||||
exec "./src/forum"
|
exec "./src/forum"
|
||||||
|
|
||||||
task frontend, "Builds the necessary JS frontend (with CSS)":
|
task frontend, "Builds the necessary JS frontend (with CSS)":
|
||||||
exec "nimble c -r src/frontend/buildcss"
|
exec "nimble c -r src/buildcss"
|
||||||
exec "nimble js -d:release src/frontend/forum.nim"
|
exec "nimble js -d:release src/frontend/forum.nim"
|
||||||
mkDir "public/js"
|
mkDir "public/js"
|
||||||
cpFile "src/frontend/nimcache/forum.js", "public/js/forum.js"
|
cpFile "src/frontend/nimcache/forum.js", "public/js/forum.js"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
@import "custom-style";
|
||||||
|
|
||||||
// Import full Spectre source code
|
// Import full Spectre source code
|
||||||
@import "spectre/src/spectre";
|
@import "spectre/src/spectre";
|
||||||
|
|
||||||
@import "custom-style";
|
|
||||||
|
|
||||||
// Global styles.
|
// Global styles.
|
||||||
// - TODO: Make these non-global.
|
// - TODO: Make these non-global.
|
||||||
.btn, .form-input {
|
.btn, .form-input {
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 70 B |
1
public/images/logo.png
Symbolic link
1
public/images/logo.png
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/Users/dom/projects/nimforum/forum.nim-lang.org/public/images/logo.png
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 70 B |
35
src/buildcss.nim
Normal file
35
src/buildcss.nim
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import os, strutils
|
||||||
|
|
||||||
|
import sass
|
||||||
|
|
||||||
|
import utils
|
||||||
|
|
||||||
|
proc buildCSS*(config: Config) =
|
||||||
|
let publicLoc = "public"
|
||||||
|
var includePaths: seq[string] = @[]
|
||||||
|
# Check for a styles override.
|
||||||
|
var hostname = config.hostname
|
||||||
|
if not existsDir(hostname):
|
||||||
|
hostname = "localhost.local"
|
||||||
|
|
||||||
|
let dir = getCurrentDir() / hostname / "public"
|
||||||
|
includePaths.add(dir / "css")
|
||||||
|
createDir(publicLoc / "images")
|
||||||
|
let logo = publicLoc / "images" / "logo.png"
|
||||||
|
removeFile(logo)
|
||||||
|
createSymlink(
|
||||||
|
dir / "images" / "logo.png",
|
||||||
|
logo
|
||||||
|
)
|
||||||
|
|
||||||
|
let cssLoc = publicLoc / "css"
|
||||||
|
sass.compileFile(
|
||||||
|
cssLoc / "nimforum.scss",
|
||||||
|
cssLoc / "nimforum.css",
|
||||||
|
includePaths=includePaths
|
||||||
|
)
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
let config = loadConfig()
|
||||||
|
buildCSS(config)
|
||||||
|
echo("CSS Built successfully")
|
||||||
|
|
@ -14,9 +14,7 @@ import
|
||||||
import cgi except setCookie
|
import cgi except setCookie
|
||||||
import options
|
import options
|
||||||
|
|
||||||
import sass
|
import auth, email, utils, buildcss
|
||||||
|
|
||||||
import auth, email, utils
|
|
||||||
|
|
||||||
import frontend/threadlist except User
|
import frontend/threadlist except User
|
||||||
import frontend/[
|
import frontend/[
|
||||||
|
|
@ -245,9 +243,7 @@ proc initialise() =
|
||||||
isFTSAvailable = db.getAllRows(sql("SELECT name FROM sqlite_master WHERE " &
|
isFTSAvailable = db.getAllRows(sql("SELECT name FROM sqlite_master WHERE " &
|
||||||
"type='table' AND name='post_fts'")).len == 1
|
"type='table' AND name='post_fts'")).len == 1
|
||||||
|
|
||||||
let cssLoc = "public" / "css"
|
buildCSS(config)
|
||||||
if not existsFile(cssLoc / "nimforum.css"):
|
|
||||||
sass.compileFile(cssLoc / "nimforum.scss", cssLoc / "nimforum.css")
|
|
||||||
|
|
||||||
# Read karax.html and set its properties.
|
# Read karax.html and set its properties.
|
||||||
karaxHtml = readFile("public/karax.html") %
|
karaxHtml = readFile("public/karax.html") %
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import sass, os
|
|
||||||
|
|
||||||
when isMainModule:
|
|
||||||
compileFile(
|
|
||||||
getCurrentDir() / "public" / "css" / "nimforum.scss",
|
|
||||||
getCurrentDir() / "public" / "css" / "nimforum.css"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo("Compiled CSS")
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue