2017-09-13 123 views
0

我正在開發Shiny應用程序,我用HTML,CSS和js創建了UI代碼,並將它們保存在www子文件夾和app.R主文件夾中。RShiny無法加載具有外部HTML文件的css文件

和我的應用程序在如下

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

當我試圖運行的應用程序的代碼,它是附加CSS和JS代碼。

請幫我解決這個問題。 謝謝。

回答

0

這是我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也位於裏面!

希望它有幫助!