Skip to content

@import appears broken #26

Closed
skagra opened this Issue May 28, 2012 · 9 comments

5 participants

@skagra
skagra commented May 28, 2012

Summary:

@import throws in 1.3.0.3 which worked correctly in 1.0.1

Environment:

grails: 2.0.4
lesscss-resources: 1.3.0.3
resources: 1.1.6
java: 1.6.0_31

Description:

web-app/less/base.less contains an import such as:

@import 'settings.less';

settings.less is also in web-app/less

grails dev run-app

throws with:

2012-05-28 16:33:34,188 [pool-7-thread-1] ERROR resourceMappers.LesscssResourceMapper - error compiling less file: /mnt/home/harveyp/.grails/2.0.4/projects/servicecatalog/tomcat/work/Tomcat/localhost/servicecatalog/grails-resources/less/base.less
org.lesscss.LessException: Couldn't load settings.less (0)
at org.lesscss.LessCompiler.compile(LessCompiler.java:252)
at org.lesscss.LessCompiler.compile(LessCompiler.java:302)
at org.lesscss.LessCompiler.compile(LessCompiler.java:326)
at org.lesscss.LessCompiler.compile(LessCompiler.java:292)
at org.lesscss.LessCompiler.compile(LessCompiler.java:279)
at LesscssResourceMapper.map(LesscssResourceMapper.groovy:31)
at org.grails.plugin.resource.mapper.ResourceMapper.invoke(ResourceMapper.groovy:139)
at org.grails.plugin.resource.mapper.ResourceMapper.invokeIfNotExcluded(ResourceMapper.groovy:128)
at org.grails.plugin.resource.ResourceProcessor.applyMappers(ResourceProcessor.groovy:587)
at org.grails.plugin.resource.ResourceProcessor.prepareResource(ResourceProcessor.groovy:533)
at org.grails.plugin.resource.ResourceProcessor$_prepareSingleDeclaredResource_closure12.doCall(ResourceProcessor.groovy:602)
at org.grails.plugin.resource.util.ResourceMetaStore.addDeclaredResource(ResourceMetaStore.groovy:29)
at org.grails.plugin.resource.ResourceProcessor.prepareSingleDeclaredResource(ResourceProcessor.groovy:600)
at org.grails.plugin.resource.ResourceProcessor$_prepareResourceBatch_closure14.doCall(ResourceProcessor.groovy:625)
at org.grails.plugin.resource.ResourceProcessorBatch.each(ResourceProcessorBatch.groovy:8)
at org.grails.plugin.resource.ResourceProcessor.prepareResourceBatch(ResourceProcessor.groovy:621)
at org.grails.plugin.resource.ResourceProcessor.resourcesChanged(ResourceProcessor.groovy:804)
at org.grails.plugin.resource.ResourceProcessor.loadModules(ResourceProcessor.groovy:800)
at org.grails.plugin.resource.ResourceProcessor.reloadAll(ResourceProcessor.groovy:1056)
at ResourcesGrailsPlugin$_closure3.doCall(ResourcesGrailsPlugin.groovy:172)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.mozilla.javascript.JavaScriptException: object Object
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1057)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at org.mozilla.javascript.Context.evaluateString(Context.java:1111)
at org.lesscss.LessCompiler.compile(LessCompiler.java:238)
... 24 more

The plugin attempts to load the settings.less from the root directory of the project (incidentally moving settings.less to that location as a work around does not solve the problem).

@paulfairless
Owner

I've tried the plugin with twitter bootstap which uses countless imports successfully, but not with grails 2.0.4.

The error looks like it could be a syntax issue in your settings.less. Could you provide an example config and files (or even better a test case) and I can investigate further.

Thanks
Paul

@paulfairless
Owner

noticed that it works if you use double quotes:

@import "settings.less";

will update docs while I investigate this

@skagra
skagra commented Jun 5, 2012
@skagra
skagra commented Jun 6, 2012
@domurtag
domurtag commented Dec 1, 2012

Could someone please update the docs with this info, I spent a lot of time trying to figure out what I was doing wrong

@lhanson
lhanson commented Dec 27, 2012

Does the LESS syntax support single quotes and the Java library needs to be fixed, or is this merely a documentation error?

@paulfairless
Owner

docs updated.

there is an open issue with the compiler which includes supporting single quotes marceloverdijk/lesscss-maven-plugin#4

@lhanson
lhanson commented Mar 2, 2013

FYI, the docs at http://grails.org/plugin/lesscss-resources say:

The import directive must use double quotes for the LESS compiler

but the example directly below still uses single quotes:
@import 'imported_style.less';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.