首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Suave web中使用css

如何在Suave web中使用css
EN

Stack Overflow用户
提问于 2017-12-19 16:43:27
回答 1查看 185关注 0票数 3

我是个F#编程新手,

现在我试着用F#和Suave做网页,然后我从this link开始

我有一个问题,我不能在我的项目中使用css (见图)

id="box" wasn't show on browser

文件View.fs

代码语言:javascript
复制
let index container =
html [] [
    head [] [
        title [] "Suave Music Store"
        cssLink "/Site.css"
    ]

    body [] [
        div ["id", "header"] [
            tag "h1" [] [
                a Path.home [] [Text "F# Suave Music Store"]
            ]
        ]

        div ["id", "main"] [
            div ["id", "box"] [
                a Path.Store.browse [] [Text "Test Link"]
                tag "h1" [] [
                    a "http://www.google.com" [] [Text "Google"]
                ]
            ]
        ]
        div ["id", "footer"] [
            Text "built with "
            a "http://fsharp.org" [] [Text "F#"]
            Text " and "
            a "http://suave.io" [] [Text "Suave.IO"]
        ]
    ]
]
|> htmlToString

和文件Site.css中的#box

代码语言:javascript
复制
#box
{
    border:4px solid #000;
}

我怎么才能修复它?

EN

回答 1

Stack Overflow用户

发布于 2017-12-19 22:15:56

这可能是一个缓存问题-如果您正在更改CSS文件,而浏览器缓存了旧版本,则服务器上的最新更改可能不可见。

您可能可以配置您的浏览器以避免缓存。或者,您可以更改服务器以发送禁用缓存的HTTP标头(在开发和调试期间):

代码语言:javascript
复制
let noCache =
  Writers.setHeader "Cache-Control" "no-cache, no-store, must-revalidate"
  >>= Writers.setHeader "Pragma" "no-cache"
  >>= Writers.setHeader "Expires" "0"

// And then in your main handler add 'noCache'
pathRegex "(.*)\.(css|png)" >=> noCache >=> Files.browseHome
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47882985

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档