【问题标题】:After grails 3 upgrade, less file are not picked up for compilationgrails 3 升级后,less 文件没有被拾取编译
【发布时间】:2016-05-24 13:54:48
【问题描述】:

我正在尝试将我的一个项目升级到 grails 3.x。 大多数事情都按预期工作,除了 less 管道插件。

这是我的build.gradle

buildscript {
    ext {
        grailsVersion = project.grailsVersion
    }
    repositories {
        mavenCentral()
        mavenLocal()
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.6.7'
        classpath 'com.bertramlabs.plugins:less-asset-pipeline:2.6.7'
        classpath "org.grails.plugins:hibernate:4.3.10.5"
    }
}

....
apply plugin: "asset-pipeline"
....
dependencies {
    ...
    runtime "org.grails.plugins:asset-pipeline"
    runtime 'com.bertramlabs.plugins:asset-pipeline-core:2.6.7'
    runtime 'com.bertramlabs.plugins:less-asset-pipeline:2.6.7'
}

在配置中我有这一行(假设控制编译): grails.assets.less.compiler = 'less4j'

另外,我的断言文件夹如下所示:

当我运行应用程序时,所有文件都不会被编译和/或包含在页面中。

我的 main.less 文件如下所示:

@import "../vendor/bootstrap/less/bootstrap.less";
@import "../vendor/font-awesome/less/font-awesome.less";
@import "rrm.less";

rest of a file...

我错过了什么?

谢谢,

【问题讨论】:

  • 检查在您的依赖项中将 runtime 更改为 asset for less-asset-pipeline 是否有帮助。资产的 gradle 插件添加了这个依赖范围。应该是assets 'com.bertramlabs.plugins:less-asset-pipeline:2.6.7'。还要从构建脚本依赖项中删除对 less-asset 的依赖项,因为应该只有 gradle 插件。
  • 嗯,在此更改后我收到错误:ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[grailsDispatcherServlet] - Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Filter execution threw an exception] with root cause java.lang.RuntimeException: File was not sourced from the same ScanDirectory /Users/ShurikAg/Dev/grails/priz/grails-app/assets/vendor/bootstrap/less/bootstrap.less scanDir: /Users/ShurikAg/Dev/grails/priz/grails-app/assets/images
  • 是否允许引用stylesheets文件夹之外的文件?
  • 我认为这是不允许的。您不能将它们移动到样式表并检查这是否解决了您的问题?

标签: grails less asset-pipeline grails-3.0


【解决方案1】:

这种错误看起来像链接到你的 js 上还有一个 ../ 需要

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 2014-03-06
    • 1970-01-01
    • 2014-08-26
    • 1970-01-01
    • 2015-07-10
    相关资源
    最近更新 更多