From 525fb261b477752479d59ebedadbf1451b6d4861 Mon Sep 17 00:00:00 2001 From: cstjean Date: Tue, 7 Jan 2020 11:16:24 -0500 Subject: [PATCH] Fix /assets/ loading code --- README.md | 4 +++- src/examples/files.jl | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fea95e50..60db5536 100644 --- a/README.md +++ b/README.md @@ -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//`. +**DEPRECATED**: The `Mux.pkgfiles` middleware (included in `Mux.defaults`) serves static files under the `assets` directory in any Julia package at `/pkg//`. + +Please use the package `AssetRegistry.jl` instead to register assets directory. ## Integrate with WebSocket diff --git a/src/examples/files.jl b/src/examples/files.jl index 655d81d0..9020224b 100644 --- a/src/examples/files.jl +++ b/src/examples/files.jl @@ -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