css - 将 Less 和 CSS 文件与 grails lesscss-resource 捆绑在一起

标签 css grails less grails-plugin

在我的 grails 应用程序中,我定义了以下资源模块,其中混合了由 Less 生成的 CSS 文件和常规 CSS 文件。

responsive {
    dependsOn 'jquery'

    resource 'js/responsive/bootstrap.js'

    resource 'css/footer.css'
    resource url: 'less/style.less', attrs: [rel: "stylesheet/less", type: 'css'], bundle: 'bundle_responsive'
}

根据plugin docs , bundle: 'bundle_responsive' 应该将所有 CSS 文件捆绑在一起。当页面加载时,我看到确实只有一个 CSS 包

<link href="/summer-festivals/bundle-bundle_responsive_head.css" type="text/css" rel="stylesheet" media="screen, projection" />

但是,找不到捆绑文件,所以出现错误:

ERROR resource.ResourceMeta - Resource not found: /bundle-bundle_responsive_head.css

当然, bundle 中的所有资源都不会加载。如果我删除 bundle: 'bundle_responsive',所有资源都会加载,但从 Less 生成的 CSS 文件与常规 CSS 文件位于不同的包中。

如何将所有 CSS 文件捆绑在一起?

最佳答案

我没有用过这个,所以我在这里的回答纯粹是基于我阅读文档并与您的示例代码进行比较得出的。可能导致(您必须测试)的一个差异是像文档代码一样将您的 block 声明 responsive 放在单引号中,因为这可能会影响形成资源的“路径”:

不是:响应式{ ... }

但是:'responsive' { ... }

关于css - 将 Less 和 CSS 文件与 grails lesscss-resource 捆绑在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13660787/

相关文章:

javascript - 根据 slider 内容更改多个元素内容/背景

session - 在我保存后刷新 Controller 中的 session

eclipse - 在grails中使用graphql插件最终会导致:java.lang.ClassNotFoundException:org.grails.compiler.web.converters.RenderConverterTrait

css - 使用 Bootstrap 使用 css.map 进行开发

css - lesscss如何转义括号

javascript - 如何在图库中的图像上获得不同的悬停覆盖

css - 为什么我的 float 不会填满页面上的可用空间

grails - 单选<g :select> is producing more than one "selected" item by default

css - 将相同的选择器连接成一个

javascript - 如何使搜索栏的结果列表可通过向上/向下箭头导航?