Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables in selectors are not resolved #14

Open
dellermann opened this issue Sep 2, 2014 · 1 comment
Open

Variables in selectors are not resolved #14

dellermann opened this issue Sep 2, 2014 · 1 comment

Comments

@dellermann
Copy link

I have the following LESS files:

grails-app/assets/stylesheets/test-import.less:

@prefix: foo;

.@{prefix} {
  color: red;
}

grails-app/assets/stylesheets/test-main.less:

@import "test-import";

.bar {
  .foo;
}

If I include this file using <asset:stylesheet src="test-main" /> then I get the following LESS compiler error:

errors.GrailsExceptionResolver Less4jException occurred when processing request: [GET] /my-app/assets/test-main.css - parameters:
compile: false
Could not compile less. 1 error(s) occurred:
ERROR 4:3 Could not find mixin named ".foo".
. Stacktrace follows:
com.github.sommeri.less4j.Less4jException: Could not compile less. 1 error(s) occurred:
ERROR 4:3 Could not find mixin named ".foo".
        at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.compile(ThreadUnsafeLessCompiler.java:77)
        at asset.pipeline.less.Less4jProcessor.process(Less4jProcessor.groovy:30)
        at asset.pipeline.less.LessAssetFile.processedStream(LessAssetFile.groovy:39)
        at asset.pipeline.DirectiveProcessor.fileContents(DirectiveProcessor.groovy:112)
        at asset.pipeline.AssetProcessorService.serveUncompiledAsset(AssetProcessorService.groovy:62)
        at asset.pipeline.AssetsController.index(AssetsController.groovy:26)
        at asset.pipeline.AssetPipelineFilter.doFilter(AssetPipelineFilter.groovy:61)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

Obviously, the selector containing the prefix is not compiled and thus, cannot be mixed in. However, when pre-compiling LESS files in production environment, it works.

Working with computed selectors is necessary, e. g. when using LESS files of FontAwesome.

@davydotcom
Copy link
Contributor

You might try turning the compiler mode back to standard and not using less4j. Could be a bug in less4j

On Sep 2, 2014, at 7:18 AM, Daniel Ellermann notifications@github.com wrote:

I have the following LESS files:

grails-app/assets/stylesheets/test-import.less:

@Prefix: foo;

.@{prefix} {
color: red;
}
grails-app/assets/stylesheets/test-main.less:

@import "test-import";

.bar {
.foo;
}
If I include this file using <asset:stylesheet src="test-main" /> then I get the following LESS compiler error:

errors.GrailsExceptionResolver Less4jException occurred when processing request: [GET] /my-app/assets/test-main.css - parameters:
compile: false
Could not compile less. 1 error(s) occurred:
ERROR 4:3 Could not find mixin named ".foo".
. Stacktrace follows:
com.github.sommeri.less4j.Less4jException: Could not compile less. 1 error(s) occurred:
ERROR 4:3 Could not find mixin named ".foo".
at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.compile(ThreadUnsafeLessCompiler.java:77)
at asset.pipeline.less.Less4jProcessor.process(Less4jProcessor.groovy:30)
at asset.pipeline.less.LessAssetFile.processedStream(LessAssetFile.groovy:39)
at asset.pipeline.DirectiveProcessor.fileContents(DirectiveProcessor.groovy:112)
at asset.pipeline.AssetProcessorService.serveUncompiledAsset(AssetProcessorService.groovy:62)
at asset.pipeline.AssetsController.index(AssetsController.groovy:26)
at asset.pipeline.AssetPipelineFilter.doFilter(AssetPipelineFilter.groovy:61)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Obviously, the selector containing the prefix is not compiled and thus, cannot be mixed in. However, when pre-compiling LESS files in production environment, it works.

Working with computed selectors is necessary, e. g. when using LESS files of FontAwesome.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants