【问题标题】:RShiny unable to load css file with external HTML fileR Shiny 无法使用外部 HTML 文件加载 css 文件
【发布时间】:2017-09-13 06:54:58
【问题描述】:

我正在开发 Shiny 应用程序,我使用 HTML、CSS 和 js 创建了 UI 代码,并将它们保存在 www 子文件夹和主文件夹中的 app.R 中。

我在应用中的代码如下

runApp(
shinyApp(
    ui = shinyUI(
        htmlTemplate("www/index.html")  
    ),  
    server = shinyServer(function(input, output) {
    })
))

当我尝试运行应用程序代码时,它会附加 CSS 和 JS。

请帮我解决这个问题。 谢谢。

【问题讨论】:

    标签: javascript html css r shiny


    【解决方案1】:

    这是我的template.html

    <!DOCTYPE html>
    <html>
      <head>
        <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
        {{ headContent() }}
      </head>
      <body>
        <!-- JavaScript code that uses D3 here -->
    
        {{ d3heatmap::d3heatmap(mtcars, scale="column", colors="Blues") }}
      </body>
    </html>
    

    app.R 文件

    shinyApp(
        ui = shinyUI(
            htmlTemplate("template.html")  
        ),  
        server = shinyServer(function(input, output) {
        })
    )
    

    template.html 就在 app.R 所在的 app 文件夹中!

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-12
      • 2016-03-14
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多