如何将样式和脚本子目录添加到电梯项目
如何向电梯项目(使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在提供静态文件方面,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).