diff --git a/src/main/frontend/config.cljs b/src/main/frontend/config.cljs index 2836db5783..03a75bddc9 100644 --- a/src/main/frontend/config.cljs +++ b/src/main/frontend/config.cljs @@ -373,6 +373,15 @@ (get-file-path repo (str app-name "/" export-css-file))))) +(defn expand-relative-assets-path + ;; ../assets/xxx -> {assets|file}://{current-graph-root-path}/xxx + [source] + (when-let [protocol (and (string? source) + (not (string/blank? source)) + (if (util/electron?) "assets" "file"))] + + (string/replace + source "../assets" (util/format "%s://%s/assets" protocol (get-repo-dir (state/get-current-repo)))))) (defn get-custom-js-path ([] diff --git a/src/main/frontend/handler/ui.cljs b/src/main/frontend/handler/ui.cljs index 20817d6580..3e160b1bdd 100644 --- a/src/main/frontend/handler/ui.cljs +++ b/src/main/frontend/handler/ui.cljs @@ -125,7 +125,8 @@ [] (when-let [style (or (state/get-custom-css-link) - (db-model/get-custom-css) + (some-> (db-model/get-custom-css) + (config/expand-relative-assets-path)) ;; (state/get-custom-css-link) )] (util/add-style! style)))