gpt4 book ai didi

Grails twitter-bootstrap 插件资源未找到

转载 作者:行者123 更新时间:2023-12-02 13:51:38 26 4
gpt4 key购买 nike

我已经为此搜索了stackoverflow并找到了一些类似的引用资料,但没有具体的解决方案......

我正在使用带有 twitter-bootstrap:3.2.1 插件的 Grails 2.4.2,但在运行应用程序期间出现以下错误:

| Error 2014-07-26 11:51:48,592 [localhost-startStop-1] ERROR resource.ResourceMeta  - Resource not found: /assets/bootstrap-fixtaglib.css
| Error 2014-07-26 11:51:48,668 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap.css
| Error 2014-07-26 11:51:48,725 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-theme.css
| Error 2014-07-26 11:51:48,778 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-alert.js
| Error 2014-07-26 11:51:48,807 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-affix.js
| Error 2014-07-26 11:51:48,837 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-dropdown.js
| Error 2014-07-26 11:51:48,860 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-modal.js
| Error 2014-07-26 11:51:48,888 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-popover.js
| Error 2014-07-26 11:51:48,907 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-scrollspy.js
| Error 2014-07-26 11:51:48,921 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-tab.js
| Error 2014-07-26 11:51:48,934 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-tooltip.js
| Error 2014-07-26 11:51:48,947 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-button.js
| Error 2014-07-26 11:51:48,959 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-carousel.js
| Error 2014-07-26 11:51:48,977 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-collapse.js
| Error 2014-07-26 11:51:48,996 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-transition.js
| Error 2014-07-26 11:51:49,012 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap.less

该插件的重点是简化 Assets 管道并让插件将所有内容放置在适当的位置。

我有我的 BuildConfig.groovy 设置来拉插件:
...
plugins {
// plugins for the build system only
build ":tomcat:7.0.54"

// plugins for the compile step
compile ":scaffolding:2.1.2"
//compile ':cache:1.1.7'
compile ":asset-pipeline:1.8.11"
compile ":twitter-bootstrap:3.2.1"

// plugins needed at runtime but not for compilation
//runtime ":hibernate4:4.3.5.4" // or ":hibernate:3.6.10.16"
//runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
runtime ":resources:1.2.8"

// Uncomment these to enable additional asset-pipeline capabilities
//compile ":sass-asset-pipeline:1.7.4"
compile ":less-asset-pipeline:1.7.0"
//compile ":coffee-asset-pipeline:1.7.0"
//compile ":handlebars-asset-pipeline:1.3.0.3"
}
...

据我所知,我的 GSP 设置正确:
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Task Master - Tasks</title>
<r:require module="jquery"/>
<r:require module="bootstrap-js"/>
<r:require module="bootstrap"/>
<r:layoutResources/>
</head>

<body class="container">

<h1>Task Master - Tasks</h1>
<r:layoutResources/>
</body>
</html>

我检查了一下,它们不在/assets 下,因为错误状态。我看到有些人通过手动复制 Assets 来破解解决方案,但是插件有什么意义吗?要么我遗漏了一些简单的东西,要么插件中存在错误。有任何想法吗?谢谢。

——瑞安

最佳答案

在 Grails 2.4 中,asset-pipeline 是获取客户端静态资源的默认机制。在您的 BuildConfig 中使用“ Assets 管道”以及“资源”(2.4 之前的默认机制)。我不确定,如果这个配置真的是你想要的,它是否真的有效。

只有 Assets 管道的有效配置应该是:

BuildConfig.groovy:

plugins {
compile ":asset-pipeline:1.8.11"
compile ":twitter-bootstrap:3.2.1"
runtime ":jquery:1.11.1"
}

grails-app/views/layouts/main.gsp:
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Task Master - Tasks</title>
<asset:stylesheet href="application.css"/>
</head>

<body class="container">
<h1>Task Master - Tasks</h1>
<asset:javascript src="application.js"/>
</body>
</html>

grs-app/assets/stylesheets/application.css:
/*
*= require bootstrap
*= require_tree .
*/

grs-app/assets/javascript/application.js:
//= require jquery
//= require bootstrap
//= require_tree .

如需更多信息,请参阅 asset-pipeline plugin 的文档。以及 twitter-bootstrap 的文档插入。

I checked and they aren't under /assets as the errors state



这是真的,因为不会在您的应用程序中复制任何内容,而是将资源保存在 assets directory 中。的引导插件。 Assets 管道插件扫描每个插件的 Assets 文件夹(或出于兼容性目的的 web-app 文件夹)并将其组合起来,因此在生成的 war 中,所有资源都可用。

关于Grails twitter-bootstrap 插件资源未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24976259/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com