Skip to content

can't load resource "dynamically" #2

Description

@Ramblurr
(def js-src ["public/widgets/popover.js"  "public/app.js"])
(def js-assets
  (map #(h/static-asset
         {:body         (h/load-resource %)
          :content-type "text/javascript"
          :compress?    false}) js-src))

result

Unexpected error (ClassCastException) macroexpanding h/load-resource at (src/app/routes.clj:44:25).
class clojure.lang.Symbol cannot be cast to class java.lang.String (clojure.lang.Symbol is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')

root cause: load-resource is a macro so can't be used in a dynamic context like that.

possible solutions:

  1. change the macro to evaluate the input
  2. expose the non-macro resource->bytes function in hyperlith.core

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions