diff --git a/assets.go b/assets.go index 3d0c57cc..94b3e865 100644 --- a/assets.go +++ b/assets.go @@ -6,6 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/aerogo/sitemap" "github.com/animenotifier/arn" + "github.com/animenotifier/notify.moe/components/css" "github.com/animenotifier/notify.moe/components/js" ) @@ -18,6 +19,9 @@ func configureAssets(app *aero.Application) { serviceWorkerBytes, err := ioutil.ReadFile("sw/service-worker.js") serviceWorker := string(serviceWorkerBytes) + // CSS bundle + cssBundle := css.Bundle() + if err != nil { panic("Couldn't load service worker") } @@ -26,8 +30,8 @@ func configureAssets(app *aero.Application) { return ctx.JavaScript(scriptBundle) }) - app.Get("/scripts.js", func(ctx *aero.Context) string { - return ctx.JavaScript(scriptBundle) + app.Get("/styles", func(ctx *aero.Context) string { + return ctx.CSS(cssBundle) }) app.Get("/service-worker", func(ctx *aero.Context) string { diff --git a/config.json b/config.json index f6b778ef..9ef63fc3 100644 --- a/config.json +++ b/config.json @@ -30,7 +30,8 @@ "main": "main" }, "push": [ - "/scripts" + "/scripts", + "/styles" ], "manifest": { "short_name": "notify.moe", diff --git a/layout/layout.pixy b/layout/layout.pixy index dc89ce42..2526d847 100644 --- a/layout/layout.pixy +++ b/layout/layout.pixy @@ -1,6 +1,8 @@ component Layout(app *aero.Application, ctx *aero.Context, user *arn.User, openGraph *arn.OpenGraph, meta, tags []string, organization string, content string) html(lang="en") head + link(rel="stylesheet", href="/styles") + if openGraph != nil title= openGraph.Tags["og:title"] else diff --git a/main.go b/main.go index efe7e943..8e01f2b2 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "github.com/aerogo/session-store-nano" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/auth" - "github.com/animenotifier/notify.moe/components/css" "github.com/animenotifier/notify.moe/middleware" "github.com/animenotifier/notify.moe/pages" ) @@ -24,9 +23,6 @@ func configure(app *aero.Application) *aero.Application { app.Sessions.Duration = 3600 * 24 * 30 * 6 app.Sessions.Store = nanostore.New(arn.DB.Collection("Session")) - // CSS - app.SetStyle(css.Bundle()) - // Security configureHTTPS(app) diff --git a/styles/include/mixins.scarlet b/styles/include/mixins.scarlet index 5448388a..35ebc235 100644 --- a/styles/include/mixins.scarlet +++ b/styles/include/mixins.scarlet @@ -26,10 +26,10 @@ mixin vertical-wrap-center align-items center mixin noise-light - background-image url("/images/elements/noise-light.png") + background-image url("//media.notify.moe/images/elements/noise-light.png") mixin noise-strong - background-image url("/images/elements/noise-strong.png") + background-image url("//media.notify.moe/images/elements/noise-strong.png") mixin ui-element border 1px solid ui-border-color