Yesod 0.9.3.2 中静态 CSS 的链接

发布于 2024-12-09 22:26:46 字数 1598 浏览 0 评论 0原文

我正在遵循 yesod wiki 上的 yesod 教程,但在链接到外部 css 框架(蓝图)时遇到了困难。

我使用脚手架工具创建了该网站,到目前为止,使用“yesod devel”一切都工作正常。

我已将蓝图文件下载到 static/css/blueprint 并将以下内容添加到 default-layout-wrapper.hamlet:

!!!
<html>
    <head
        <title>#{pageTitle pc}
        <link rel=stylesheet type=text/css media=screen href=@{StaticR css_blueprint_screen_css}>
        <link rel=stylesheet type=text/css media=print href=@{StaticR css_blueprint_print_css}>
        ^{pageHead pc}
    <body
        ^{pageBody pc}

我收到的错误是:

Foundation.hs:98:27:
    Not in scope: `css_blueprint_screen_css'
    In the result of the splice:
      $(hamletFile "hamlet/default-layout-wrapper.hamlet")
    To see what the splice expanded to, use -ddump-splices
    In the first argument of `hamletToRepHtml', namely
      `$(hamletFile "hamlet/default-layout-wrapper.hamlet")'
    In the expression:
      hamletToRepHtml
        ($(hamletFile "hamlet/default-layout-wrapper.hamlet"))

Foundation.hs:98:27:
    Not in scope: `css_blueprint_print_css'
    In the result of the splice:
      $(hamletFile "hamlet/default-layout-wrapper.hamlet")
    To see what the splice expanded to, use -ddump-splices
    In the first argument of `hamletToRepHtml', namely
      `$(hamletFile "hamlet/default-layout-wrapper.hamlet")'
    In the expression:
      hamletToRepHtml
        ($(hamletFile "hamlet/default-layout-wrapper.hamlet"))
Starting development server...

我在 Mac 上运行 ghc-7.0.3...我以为我了解 StaticR 的工作原理,但我显然错过了一些东西。有什么想法吗?

提前致谢, 尼尔

I'm following along with the yesod tutorial on the yesod wiki, and hitting a wall linking to an external css framework (blueprint).

I created the site using the scaffolding tool, and everything has been working correctly so far using 'yesod devel'.

I've downloaded the blueprint files into static/css/blueprint and added the following to default-layout-wrapper.hamlet:

!!!
<html>
    <head
        <title>#{pageTitle pc}
        <link rel=stylesheet type=text/css media=screen href=@{StaticR css_blueprint_screen_css}>
        <link rel=stylesheet type=text/css media=print href=@{StaticR css_blueprint_print_css}>
        ^{pageHead pc}
    <body
        ^{pageBody pc}

The error I'm getting is:

Foundation.hs:98:27:
    Not in scope: `css_blueprint_screen_css'
    In the result of the splice:
      $(hamletFile "hamlet/default-layout-wrapper.hamlet")
    To see what the splice expanded to, use -ddump-splices
    In the first argument of `hamletToRepHtml', namely
      `$(hamletFile "hamlet/default-layout-wrapper.hamlet")'
    In the expression:
      hamletToRepHtml
        ($(hamletFile "hamlet/default-layout-wrapper.hamlet"))

Foundation.hs:98:27:
    Not in scope: `css_blueprint_print_css'
    In the result of the splice:
      $(hamletFile "hamlet/default-layout-wrapper.hamlet")
    To see what the splice expanded to, use -ddump-splices
    In the first argument of `hamletToRepHtml', namely
      `$(hamletFile "hamlet/default-layout-wrapper.hamlet")'
    In the expression:
      hamletToRepHtml
        ($(hamletFile "hamlet/default-layout-wrapper.hamlet"))
Starting development server...

I'm on a Mac, running ghc-7.0.3... I thought I understand how StaticR works, but I'm obviously missing something. Any ideas?

Thanks in advance,
Neil

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海夜未眠 2024-12-16 22:26:46

您需要触摸Settings/StaticFiles.hs吗?一般来说,yesod devel 或 yesod build 会自动为您处理,但这是您首先想到的事情。

Do you need to touch Settings/StaticFiles.hs? In general, yesod devel or yesod build will handle that for you automatically, but it's the first thing that comes to mind.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文