【问题标题】:Adding custom CSS file to Dash in Julia在 Julia 中将自定义 CSS 文件添加到 Dash
【发布时间】:2021-09-29 07:43:42
【问题描述】:

对于 Python,可以选择将自定义 CSS 添加到 Dash 应用程序。这个方法看起来很简单,它说

只需在应用目录的根目录中创建一个名为 assets 的文件夹 并将您的 CSS 和 JavaScript 文件包含在该文件夹中。短跑将 自动提供此文件夹中包含的所有文件。 默认情况下,请求资产的 url 将是 /assets 但你可以 使用 dash.Dash 的 assets_url_path 参数自定义它

来源:https://dash.plotly.com/external-resources

但是,当我尝试在 Julia 中这样做时,没有任何反应。

这个功能在 Julia 中有吗?如果没有,我该怎么做?

【问题讨论】:

    标签: css julia plotly-dash


    【解决方案1】:

    发现了一个 hack,但不知道这是否是正确的方法......

    基本上试图通过methods(dash) 找到app = dash() 的输入

    julia> methods(dash)
    # 1 method for generic function "dash":
    [1] dash(; external_stylesheets, external_scripts, url_base_pathname, requests_pathname_prefix, routes_pathname_prefix, assets_folder, assets_url_path, assets_ignore, serve_locally, suppress_callback_exceptions, prevent_initial_callbacks, eager_loading, meta_tags, index_string, assets_external_path, include_assets_files, show_undo_redo, compress, update_title) in Dash at C:\Users\<User>\.julia\packages\Dash\Weukk\src\app\dashapp.jl:291
    

    我注意到一个 arg assets_folder。放入绝对路径似乎可以工作,所以完整的代码看起来像这样

    using Dash
    app = dash(assets_folder="/absolute/path/to/assets")
    

    【讨论】:

      猜你喜欢
      • 2021-05-25
      • 1970-01-01
      • 2014-06-03
      • 1970-01-01
      • 2013-08-02
      • 2018-11-23
      • 1970-01-01
      • 1970-01-01
      • 2020-06-19
      相关资源
      最近更新 更多