Skip to content

Assets should be able to live ABOVE the assets dir (two implementations attached) #4778

@tekacs

Description

@tekacs

Feature Request

The current implementation of assets in Dioxus doesn't provide for being able to put assets in the root of the output public directory.

When targeting web, this is a very common need - in particular .well-known paths are super commonly necessary, for everything from Apple site associations to security. They must live in /.well-known, not /assets/.well-known, and yet the assets dir is hard-coded in manganis and Dioxus.

Implement Suggestion

One possible option is to restore and improve static/asset dir functionality. This (fully implemented, tested, working) branch does that. It also correctly handles cleanup of assets that are moved/removed.

main...tekacs:dioxus:add-back-asset-dir

Another option would be to teach manganis and Dioxus to allow assets to be mounted higher in the output tree - i.e. to live above assets/. In combination with the folder functionality, we could probably just external_asset!(".well-known)" with AssetOptions directing it to live in the root instead of /assets. That's implemented here:

Pull Request #4779

I figured that this version is more in line with the direction you seem to have been heading with the removal of static_dir, so that one's a (complete, working, tested) PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliRelated to the dioxus-cli programenhancementNew feature or requestmanganisRelated to the manganis crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions