{"action":"opened","issue":{"url":"https://api.github.com/repos/koute/cargo-web/issues/112","repository_url":"https://api.github.com/repos/koute/cargo-web","labels_url":"https://api.github.com/repos/koute/cargo-web/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/koute/cargo-web/issues/112/comments","events_url":"https://api.github.com/repos/koute/cargo-web/issues/112/events","html_url":"https://github.com/koute/cargo-web/issues/112","id":335102160,"node_id":"MDU6SXNzdWUzMzUxMDIxNjA=","number":112,"title":"Feature request: Allow custom mount point and folder name for static content","user":{"login":"arturoc","id":48240,"node_id":"MDQ6VXNlcjQ4MjQw","avatar_url":"https://avatars0.githubusercontent.com/u/48240?v=4","gravatar_id":"","url":"https://api.github.com/users/arturoc","html_url":"https://github.com/arturoc","followers_url":"https://api.github.com/users/arturoc/followers","following_url":"https://api.github.com/users/arturoc/following{/other_user}","gists_url":"https://api.github.com/users/arturoc/gists{/gist_id}","starred_url":"https://api.github.com/users/arturoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arturoc/subscriptions","organizations_url":"https://api.github.com/users/arturoc/orgs","repos_url":"https://api.github.com/users/arturoc/repos","events_url":"https://api.github.com/users/arturoc/events{/privacy}","received_events_url":"https://api.github.com/users/arturoc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-23T13:49:57Z","updated_at":"2018-06-23T13:49:57Z","closed_at":null,"author_association":"NONE","body":"Right now static content is always read from static and mounted at the root. It would be useful to be able to decide through command line parameters:\r\n\r\n- where the static content is read from, eg:\r\n```\r\n    cargo web start --static-folder=assets\r\n```\r\n\r\n- where the static content is mounted in the server\r\n```\r\n    cargo web start --static-mount=/assets\r\n```\r\n\r\nThis among other things would make it easier to have files that can be read from a desktop version of an application and the wasm one while testing from the same folder using the same relative paths.\r\n\r\nFor example in the examples above one might have assets to an application stored in an `assets` folder. When reading them compiling an application as desktop one can read the files using File::open or any other file reading facilities as:\r\n```\r\n    File::open(\"assets/image.png\").unwrap()\r\n```\r\n\r\nThe from the web as:\r\n```\r\n    load_img(\"assets/image.png\")\r\n```\r\n\r\nWhere load_img is for example a function using something like: https://gist.github.com/kngwyu/a92b784195aab433143a582b248f4112  to read an image asynchronously.\r\n\r\nThis allows to have resources in any folder and to have the paths stored for example in constants or config files that are the same for both a desktop and web version of the same application.\r\n\r\nIf this is of any interest I can look into sending a PR"}}
{"actor":{"display_login":"arturoc"}}