mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-08 16:49:02 +03:00
[GH-ISSUE #202] Allow overriding specific builtin assets #100
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @luaneko on GitHub (Mar 30, 2023).
Original GitHub issue: https://github.com/sigoden/dufs/issues/202
Specific Demand
It would be useful to be able to override a specific asset file without having to override all assets. Oftentimes overriding
index.htmlandindex.jsis not necessary and onlyfavicon.icoandindex.cssneed to be overridden for theme customization. Unchanged asset files on disk need to be updated manually from new commits in the repository, which is inconvenient and error-prone.Implement Suggestion
We could modify the asset handler to use builtin assets as a fallback if an asset directory was specified and the corresponding asset file does not exist on disk.
e43554b795/src/server.rs (L557-L562)Something like this:
A CLI option could be introduced to opt into this behavior if backwards compatibility is desired.
@sigoden commented on GitHub (Apr 1, 2023):
I am not in favor of this proposal.
index.html,index.jsandindex.cssare a whole. They need to be upgraded together, or stay in the old version together.This PR may lead to a situation:
You created an index.css based on v0.33.
dufs v0.34 added a feature that causes index.css to add
.fooclass.You upgraded to v0.34, but you forgot to update
index.css, so.fooclass is missing and the UI is broken.But if you have a complete copy of the UI in assets folder, there will be no problem upgrading dufs, you just won't be able to use the new features.
@0xF4CED commented on GitHub (May 24, 2023):
How about a --favicon=/path/to/favicon.ico option?
Currently one has to maintain the whole assets directory just to customize the favicon.
@sigoden