1

I am unable to import a .less file into another one. I get a "file not found" exception, although I triple checked the path and syntax were right.

Here is how I try to import the file from within my importingFileName.less:

@import 'main';

Here is how I set the resources in my ApplicationResources.groovy

modules = {
    application {
        resource url: 'js/libs/jquery-1.7.2.min.js', disposition: 'head'
        resource url: 'js/libs/jquery-ui-1.8.20.custom.min.js', disposition: 'head'
        resource url: 'js/libs/jquery.form.js', disposition: 'head'
        resource url: 'js/application.js', disposition: 'head'
    }

    css {
        resource url: 'css/mobile.css'
        resource url: [dir: 'less', file: 'importingFileName.less'], attrs:[rel: 'stylesheet/less', type:'css']
    }
}

Here is how I call the resource from the GSPs:

<r:require modules="application, css"/>

Here is what I get:

ERROR resourceMappers.LesscssResourceMapper  - error compiling less file:
/home/userPath/.grails/2.0.3/projects/myApp/tomcat/work/Tomcat/localhost/_/grails-
resources/less/importingFileName.less

Message: Couldn't load main.less

If I bundle everything into the importingFileName.less file, the CSS is loaded correctly using those settings. Any suggestion is most welcome.

4

1 回答 1

1

根据您使用的插件版本,单引号可能会导致问题。请参阅https://github.com/paulfairless/grails-lesscss-resources/issues/26

尝试这个:

@import "main.less";

于 2012-08-16T13:34:04.593 回答