feat: add shop storefront with optimized theme CSS
- Create LoadTheme plug for loading theme settings - Add shop layout with inline CSS injection (~400 bytes vs 17KB full) - Create ShopLive.Home at / using shared ShopComponents - Wire up CSS cache invalidation when theme settings change - Replace Phoenix welcome page with themed shop home page The shop layout injects only the active theme CSS variables inline, achieving a 97% reduction compared to the full variants file used by the theme editor. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,13 @@ defmodule SimpleshopTheme.Settings do
|
||||
settings = Ecto.Changeset.apply_changes(changeset)
|
||||
json = Jason.encode!(settings)
|
||||
put_setting("theme_settings", json, "json")
|
||||
|
||||
# Invalidate and rewarm CSS cache
|
||||
alias SimpleshopTheme.Theme.{CSSCache, CSSGenerator}
|
||||
CSSCache.invalidate()
|
||||
css = CSSGenerator.generate(settings)
|
||||
CSSCache.put(css)
|
||||
|
||||
{:ok, settings}
|
||||
else
|
||||
{:error, changeset}
|
||||
|
||||
Reference in New Issue
Block a user