如何将样式和脚本子目录添加到电梯项目

发布于 2024-12-08 20:29:16 字数 433 浏览 7 评论 0原文

如何向电梯项目(使用 SBT 构建)添加子目录以更好地组织项目。

目前,我可以自定义样式的唯一方法是将 css 文件添加到 webapp 根目录,我猜我对任何自定义 js 脚本文件都会遇到类似的问题。因此,我还将有大量 .js 和 .css 文件与一堆 html 文件混合在一起。

我已经在 Boot.scala 文件中尝试了 Lift Rules 例如 LiftRules.fixCSS("static" :: "style" :: Nil, Empty) 但这似乎不起作用,我不断收到“/default.css returned 404”

并且我尝试将目录添加到静态文件夹也是如此。

我习惯了 java/jsp/servlet 方法,在这种方法中,我可以直接从任何 html/.jsp 文件访问 webapp/style 和 webapp/script 子目录。这是电梯的错误想法吗?

How can I add subdirectories to a lift project (builing with SBT) to better organise the project.

Currently, The only way I can cusomise the style is to add css files to the webapp root directory, and I'm guessing I'm going to have a similar problem with any custom js script files. So I'm going to have a lot of .js and .css files mixing around with a bunch of html files as well.

I've tried Lift Rules in the Boot.scala file
eg LiftRules.fixCSS("static" :: "style" :: Nil, Empty) but this doesn't seem to work, I keep on getting "/default.css returned 404"

and I've tried adding the directory to the static folder as well.

I'm used to a java/jsp/servlet approach where I would have webapp/style and webapp/script subdirectories that I could access from any html/.jsp files pretty much directly. Is this the wrong idea in Lift?

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

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

发布评论

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

评论(1

旧话新听 2024-12-15 20:29:16

在提供静态文件方面,Lift 与常规 JSP 应用程序没有什么不同。只需在 src/main/webapp 中创建您想要的任何目录即可,该目录将公开可用。当您希望为 Lift 编写插件或以某种方式使这些静态文件可在您自己的应用程序之外重新分发时(您不想通过声音来做到这一点),您只需要在 LiftRules 中添加 Boot w/r/t 即可的)。

Lift is no different to a regular JSP application when it comes to serving static files. Just make whatever directory you want within src/main/webapp and that will be publicly available. You only need to make additions to the Boot w/r/t to LiftRules when you wish to write a plugin for Lift or make those static files in some way redistributable outside your own application (which you don't want to do by the sounds of it).

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