Skip to content

Commit

Permalink
Merge pull request #101 from cstjean/fix-assets
Browse files Browse the repository at this point in the history
Fix /assets/ loading code
  • Loading branch information
jpsamaroo authored Jan 7, 2020
2 parents 5e2a060 + a55501d commit cd04965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ 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>/`.
Please use [AssetRegistry.jl](https://github.com/JuliaGizmos/AssetRegistry.jl) to
register an assets directory.

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

## 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 cd04965

Please sign in to comment.