Skip to content

Commit

Permalink
Fix /assets/ loading code
Browse files Browse the repository at this point in the history
  • Loading branch information
cstjean committed Jan 7, 2020
1 parent 5e2a060 commit 525fb26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ For example:

## Serving static files from a package

The `Mux.pkgfiles` middleware (included in `Mux.defaults`) serves static files under the `assets` directory in any Julia package at `/pkg/<PACKAGE>/`.
**DEPRECATED**: The `Mux.pkgfiles` middleware (included in `Mux.defaults`) serves static files under the `assets` directory in any Julia package at `/pkg/<PACKAGE>/`.

Please use the package `AssetRegistry.jl` instead to register assets directory.

## Integrate with WebSocket

Expand Down
6 changes: 3 additions & 3 deletions src/examples/files.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ function packagefiles(dirs=true)
return dir
end
end
Pkg.dir(pkg, ASSETS_DIR)
Pkg.dir(String(pkg), ASSETS_DIR) # Pkg.dir doesn't take SubString
end

branch(req -> validpath(absdir(req), joinpath(req[:path]...), dirs=dirs),
req -> (Base.warn_once("""
req -> (Base.@warn("""
Relying on /pkg/ is now deprecated. Please use the package
`AssetRegistry.jl` instead to register assets directory
""");
""", maxlog=1);
fresp(joinpath(absdir(req), req[:path]...))))
end

Expand Down

0 comments on commit 525fb26

Please sign in to comment.