diff --git a/Makefile b/Makefile index b3c4f068..5fb0a196 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,15 @@ frontend: env ## Build frontend @-rm -rf $(BUNDLE) @-mkdir $(BUNDLE) yarn build + @yarn run dart-sass -s \ + compressed templates/main.scss \ + ./static/cache/bundle/css/main.css + @yarn run dart-sass -s \ + compressed templates/mobile.scss \ + ./static/cache/bundle/css/mobile.css + @yarn run dart-sass -s \ + compressed templates/widget/main.scss \ + ./static/cache/bundle/css/widget.css @./scripts/librejs.sh @./scripts/cachebust.sh diff --git a/src/main.rs b/src/main.rs index a0ceeb1b..310cf24f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,14 +63,14 @@ lazy_static! { pub static ref JS: &'static str = FILES.get("./static/cache/bundle/bundle.js").unwrap(); pub static ref CSS: &'static str = - FILES.get("./static/cache/bundle/bundle.css").unwrap(); + FILES.get("./static/cache/bundle/css/main.css").unwrap(); pub static ref MOBILE_CSS: &'static str = - FILES.get("./static/cache/bundle/mobile.css").unwrap(); + FILES.get("./static/cache/bundle/css/mobile.css").unwrap(); pub static ref VERIFICATIN_WIDGET_JS: &'static str = FILES.get("./static/cache/bundle/verificationWidget.js").unwrap(); pub static ref VERIFICATIN_WIDGET_CSS: &'static str = - FILES.get("./static/cache/bundle/verificationWidget.css").unwrap(); + FILES.get("./static/cache/bundle/css/widget.css").unwrap(); /// points to source files matching build commit pub static ref SOURCE_FILES_OF_INSTANCE: String = { diff --git a/src/static_assets/filemap.rs b/src/static_assets/filemap.rs index e812fd6c..516ecd1e 100644 --- a/src/static_assets/filemap.rs +++ b/src/static_assets/filemap.rs @@ -39,8 +39,8 @@ mod tests { #[test] fn filemap_works() { let files = super::FileMap::new(); - let css = files.get("./static/cache/bundle/bundle.css").unwrap(); + let css = files.get("./static/cache/bundle/css/main.css").unwrap(); println!("{}", css); - assert!(css.contains("/assets/bundle/bundle")); + assert!(css.contains("/assets/bundle/css")); } } diff --git a/templates/index.ts b/templates/index.ts index ce30f589..adaa2889 100644 --- a/templates/index.ts +++ b/templates/index.ts @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -import {Router} from "./router"; +import { Router } from "./router"; import * as login from "./auth/login/ts/"; import * as register from "./auth/register/ts/"; @@ -23,32 +23,16 @@ import * as panel from "./panel/ts/index"; import settings from "./panel/settings/"; import * as deleteAccount from "./panel/settings/account/delete"; import * as updateSecret from "./panel/settings/secret/update"; -import * as addSiteKey from "./panel/sitekey/add/ts"; +import * as addSiteKey from "./panel/sitekey/add/advance/ts"; import * as editSitekey from "./panel/sitekey/edit/"; import * as deleteSitekey from "./panel/sitekey/delete/"; import * as listSitekeys from "./panel/sitekey/list/ts"; import * as notidications from "./panel/notifications/ts"; -import {MODE} from "./logger"; +import { MODE } from "./logger"; import log from "./logger"; import VIEWS from "./views/v1/routes"; -import "./main.scss"; -import "./auth/css/main.scss"; -import "./components/details-footer/main.scss"; -import "./components/error/main.scss"; -import "./components/showPassword/main.scss"; -import "./panel/css/main.scss"; -import "./panel/navbar/main.scss"; -import "./panel/settings/main.scss"; -import "./panel/notifications/main.scss"; -import "./panel/header/taskbar/main.scss"; -import "./panel/help-banner/main.scss"; -import "./panel/sitekey/add/css/main.scss"; -import "./panel/sitekey/list/css/main.scss"; - -import "./errors/main.scss"; - log.setMode(MODE.production); const router = new Router(); diff --git a/templates/main.scss b/templates/main.scss index ec66d6d0..f9a9d459 100644 --- a/templates/main.scss +++ b/templates/main.scss @@ -15,11 +15,25 @@ * along with this program. If not, see . */ +@import "./auth/css/main.scss"; +@import "./components/details-footer/main.scss"; +@import "./components/error/main.scss"; +@import "./components/showPassword/main.scss"; +@import "./panel/css/main.scss"; +@import "./panel/navbar/main.scss"; +@import "./panel/settings/main.scss"; +@import "./panel/notifications/main.scss"; +@import "./panel/header/taskbar/main.scss"; +@import "./panel/help-banner/main.scss"; +@import "./panel/sitekey/add/advance/css/main.scss"; +@import "./panel/sitekey/list/css/main.scss"; +@import "./errors/main.scss"; + // creadits: https://codepen.io/rachelandrew/pen/MmOvPr/?editors=1100 .layout { - display: grid; - grid-template-columns: minmax(250px, auto) 1fr; - grid-template-areas: 'navbar mainContent'; + display: grid; + grid-template-columns: minmax(250px, auto) 1fr; + grid-template-areas: "navbar mainContent"; } /* no grid support? check this out later */ @@ -44,19 +58,19 @@ //} nav { - // grid-row: 1/ 4; - /* needed for the floated layout */ - clear: both; - grid-area: navbar; -// height: 100%; + // grid-row: 1/ 4; + /* needed for the floated layout */ + clear: both; + grid-area: navbar; + // height: 100%; } .tmp-layout { - // grid-column: 2 / 5; - grid-area: mainContent; - max-height: 100%; - display: flex; - flex-direction: column; + // grid-column: 2 / 5; + grid-area: mainContent; + max-height: 100%; + display: flex; + flex-direction: column; } /* We need to set the widths used on floated items back to auto, and remove the bottom margin as when we have grid we have gaps. diff --git a/templates/mobile.scss b/templates/mobile.scss index c3918b70..23992eb2 100644 --- a/templates/mobile.scss +++ b/templates/mobile.scss @@ -14,9 +14,18 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ +@import "./auth/css/mobile.scss"; +@import "./components/details-footer/mobile.scss"; +@import "./panel/css/mobile.scss"; +@import "./panel/settings/mobile.scss"; +@import "./panel/header/taskbar/mobile.scss"; +@import "./panel/navbar/mobile.scss"; +@import "./panel/help-banner/mobile.scss"; +@import "./panel/sitekey/add/advance//css/mobile.scss"; +@import "./panel/sitekey/list/css/mobile.scss"; html { - overflow-x: hidden; + overflow-x: hidden; } // creadits: https://codepen.io/rachelandrew/pen/MmOvPr/?editors=1100 diff --git a/templates/mobile.ts b/templates/mobile.ts deleted file mode 100644 index 76e60c46..00000000 --- a/templates/mobile.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2021 Aravinth Manivannan - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -import "./mobile.scss"; -import "./auth/css/mobile.scss"; -import "./components/details-footer/mobile.scss"; -import "./panel/css/mobile.scss"; -import "./panel/settings/mobile.scss"; -import "./panel/header/taskbar/mobile.scss"; -import "./panel/navbar/mobile.scss"; -import "./panel/help-banner/mobile.scss"; -import "./panel/sitekey/add/css/mobile.scss"; -import "./panel/sitekey/list/css/mobile.scss"; diff --git a/webpack.config.js b/webpack.config.js index bb5fb717..7d95e8a5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,6 @@ module.exports = { mode: "production", entry: { bundle: "./templates/index.ts", - mobile: "./templates/mobile.ts", verificationWidget: "./templates/widget/index.ts", bench: "./templates/widget/service-worker.ts", },