I have problem with compilation -ms-filter property in scss mixin.
mytheme.scss
#import "../reindeer/reindeer.scss";
#import "bg-alpha.scss";
#mixin mytheme {
#include reindeer;
.v-button {
#include bg-alpha(0.7);
-ms-filter:alpha(opacity=0.4); <---- OK
}
}
bg-alpha.scss
#mixin bg-alpha ($a) {
opacity:$a;
-ms-filter:alpha(opacity=$a*100); <---- ERROR
}
During compilation is thrown this error
com.vaadin.sass.internal.parser.SCSSParseException: Error when parsing file C:\Develop...\VAADIN\themes\mytheme\bg-alpha.scss
Encountered "-ms-filter" at line 3, column 9.
Was expecting one of:
"}" ...
"+" ...
">" ...
"~" ...
"[" ...
"*" ...
"&" ...
"." ...
":" ...
<INTERPOLATION> ...
"#include" ...
"#debug" ...
"#warn" ...
"#each" ...
"#if" ...
"#extend" ...
"#content" ...
<IDENT> ...
<VARIABLE> ...
<HASH> ...
"#media" ...
"#page" ...
"#font-face" ...
<KEY_FRAME_SYM> ...
at com.vaadin.sass.internal.ScssStylesheet.get(ScssStylesheet.java:141)
at com.vaadin.sass.internal.visitor.ImportNodeHandler.traverse(ImportNodeHandler.java:69)
at com.vaadin.sass.internal.visitor.ImportNodeHandler.traverse(ImportNodeHandler.java:81)
at com.vaadin.sass.internal.ScssStylesheet.importOtherFiles(ScssStylesheet.java:192)
at com.vaadin.sass.internal.ScssStylesheet.compile(ScssStylesheet.java:185)
at com.vaadin.server.VaadinServlet.serveOnTheFlyCompiledScss(VaadinServlet.java:815)
at com.vaadin.server.VaadinServlet.serveStaticResourcesInVAADIN(VaadinServlet.java:601)
at com.vaadin.server.VaadinServlet.serveStaticResources(VaadinServlet.java:571)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:229)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
This problem belongs to mixins, because when I delete "-ms-filter:alpha(opacity=$a*100);" from bg-alpha mixin, everything is ok and no error is thrown.
Please, can anybody help me solve this problem? I googled lot of hours for finding solution, but I wasnt successful. Also I tryed simulate this problem with pure sass compilator. It seems to be right sass code.
SASS arithmetic is a fairly new feature in Vaadin 7 - I think only in Vaadin 7.1 - and appears to have a few bugs (Look at the Vaadin Forum); the SASS parser/compiler is not a separate library, but completely implemented in the Vaadin framework itself.
I've not used Vaadin + SASS in anger - but personally, I would
a) Ensure you're using Vaadin 7.1
b) If that doesn't work, try assigning the value to an interim variable first, e.g.
#mixin bg-alpha ($a) {
$msopacity=$a * 100;
opacity:$a;
-ms-filter:alpha(opacity=$msopacity);
}
Related
I am using Jenkins configuration as code (CASC) plugin to create Jenkins job during server startup inside docker. I wrote a shell script as a step inside a job configuration.
- script: >
freeStyleJob('jenkins-job-sample') {
description('Sample')
triggers {
githubPush()
}
scm {
git {
remote {
url('${GIT_URL}')
credentials('github-credentials')
}
branch '*/dev'
extensions {localBranch('dev')}
}
}
steps {
shell("""
do
cat \$OUTPUT | while read line || [[ -n \$line ]];
do
CAPP_ENTRY=\$line
GROUP_ID_PATH=(\${CAPP_ENTRY[0]})
ARTIFACT_ID=(\${CAPP_ENTRY[1]})
VERSION=(\${CAPP_ENTRY[2]})
done
done
""")
}
publishers {
}
}
After the job is created I want the final script step to be shown as below.
CAPP_ENTRY=\$line
GROUP_ID_PATH=(${CAPP_ENTRY[0]})
ARTIFACT_ID=(${CAPP_ENTRY[1]})
VERSION=(${CAPP_ENTRY[2]})
But during server startup it throws the following error.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: script: 31: unexpected char: '\' # line 31, column 34.
GROUP_ID_PATH=(\)
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150) at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120) at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132) at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350) at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:139) at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110) at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234) at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at groovy.lang.GroovyShell$parse.call(Unknown Source) at javaposse.jobdsl.dsl.AbstractDslScriptLoader.parseScript(AbstractDslScriptLoader.groovy:134) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174) at
javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScriptEngine(AbstractDslScriptLoader.groovy:101)
It seems that ${CAPP_ENTRY[0]} is getting evaluated before the job creation happens which results to be (\). I want to escape ${} from getting evaluated before job creation. I tried in below ways.
GROUP_ID_PATH=(\${CAPP_ENTRY[0]})
GROUP_ID_PATH=(\$\{CAPP_ENTRY[0]})
GROUP_ID_PATH=(\"${CAPP_ENTRY[0]}\")
None of the above worked. Highly appreciate any suggestions on how I can escape it from getting evaluated.
Found an answer. Adding a ^ solved my issue. :) (^${CAPP_ENTRY[0]})
Source: https://github.com/jenkinsci/configuration-as-code-plugin/issues/577
I have had the same issue, and so far havent found "the" solution however for a workaround I just break the string
e.g. instead of
def HOSTS_LOCATION = "../bootstrap/inventory/${ENVIRONMENT_MAP[params.region]}_aws_ec2.yaml"
I do
def HOSTS_LOCATION = "../bootstrap/inventory/" + ENVIRONMENT_MAP[params.region] + "_aws_ec2.yaml"
I found a solution on how to resize column
.col5-unit {
#include grid-column(2.4); // (12/5 = 2.4)
}
However, I'm getting this error
[16:17:17] Starting 'styles'...
[16:17:17] gulp-inject 4 files into index.scss.
[16:17:17] [Sass] Error in plugin 'gulp-sass'
Message:
no mixin named grid-column
Backtrace:
src/app/main/main.scss:110
Details:
fileName: /home/ubuntu/testapp/src/app/main/main.scss
lineNumber: 110
[16:17:17] Finished 'styles' after 35 ms
I saw grid-column in the file grid.scss but I'm not sure where to properly put my scss code.
As #akarienta's request, here is how I got it working. Without the inclusion of this import code, it won't get fixed.
#import "bower_components/foundation/scss/foundation/components/tabs";
I added that line to my own _settings.scss
then I put the code below to another scss file. It should have worked in main.scss but wondering why I didn't. I'll have to retest. Anyways, everything is working great
.col5-unit {
#include grid-column(2.4); // (12/5 = 2.4)
}
I'm trying to have Freemarker parse my template files as UTF-8, but it seems to be always parsing them as Cp1252.
2013-07-30 00:00:00.984 DEBUG freemarker.cache:? Could not find template in cache, creating new one; id=["myFile.ftl"["es_MX",Cp1252,parsed] ]
I searched and found that adding the FTL directive allows me to specify the encoding.
I added it to the template file (saved in UTF-8 with BOM in Notepad++) like so:
<#ftl encoding="UTF-8">
Estimado Usuario,
Testing this content!
<#/ftl>
But get this in the log.
MessageTemplateException [message=Unable to process template due to Encountered "<#ftl " at line 1, column 4 in myFile.ftl.
Was expecting one of:
<EOF>
<ATTEMPT> ...
<IF> ...
<LIST> ...
<FOREACH> ...
<SWITCH> ...
<ASSIGN> ...
<GLOBALASSIGN> ...
<LOCALASSIGN> ...
<_INCLUDE> ...
<IMPORT> ...
<FUNCTION> ...
<MACRO> ...
<TRANSFORM> ...
<VISIT> ...
<STOP> ...
<RETURN> ...
<CALL> ...
<SETTING> ...
<COMPRESS> ...
<COMMENT> ...
<TERSE_COMMENT> ...
<NOPARSE> ...
<BREAK> ...
<SIMPLE_RETURN> ...
<HALT> ...
<FLUSH> ...
<TRIM> ...
<LTRIM> ...
<RTRIM> ...
<NOTRIM> ...
<SIMPLE_NESTED> ...
<NESTED> ...
<SIMPLE_RECURSE> ...
<RECURSE> ...
<FALLBACK> ...
<ESCAPE> ...
<NOESCAPE> ...
<UNIFIED_CALL> ...
<WHITESPACE> ...
<PRINTABLE_CHARS> ...
<FALSE_ALERT> ...
"${" ...
"#{" ...
with inputs of {loginUrl=testURL} in myFile.ftl with locale es_MX, code=SUCCESS, arguments=[]]
Maybe I'm not doing this right?
Don't use BOM. Also don't use </#ftl>, there's only <#ftl>. But most importantly, if most of your templates are in UTF-8, just set the default encoding of FreeMarker to UTF-8 (in Spring, something like <bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">...<property name="freemarkerSettings">...<props>...<prop key="default_encoding">UTF-8</prop>), so your don't need to use #ftl because of this.
I had the same problem today and finally found a way to use the <#ftl> directive, so in case the same thing happens to anyone :
My problem was that I didn't put the <#ftl> directive on top of my template. As soon as I put it on the first line of my template, everything worked like a charm.
My scss file is this:
#import "compass/typography/lists/bullets";
.view-content ul
+no-bullets
This gives me an error on the page:
Syntax error: Invalid css after " +no-bullets": expected "{", was ""
However, when the rule looks like this:
.view-content ul {
#include no-bullets;
}
then it's OK and bullets are gone.
But I like the shorthand notation, how to enable using it?
You're right, I found the related documentation.
I tried the following and it works.
Then, I tried your and it didn't work until I remove the trailing ; on the import instruction.
#import "compass/typography/lists/bullets"
.view-content ul
+no-bullets
The following works with Compass 0.12.2. Try removing the trailing ; on the import instruction.
I wanted to configure Logback using Groovy DSL. The file is very simple:
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.ConsoleAppender
import static ch.qos.logback.classic.Level.DEBUG
import static ch.qos.logback.classic.Level.INFO
appender("stdout", ConsoleAppender) {
encoder(PatternLayoutEncoder) {
pattern = "%d %p [%c] - <%m>%n"
}
}
root(INFO, ["stdout"])
I use Gradle to build my application and run it with jettyRun. I get the following error:
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'ch.qos.logback.core.ConsoleAppender[null]' with class 'ch.qos.logback.core.ConsoleAppender' to class 'ch.qos.logback.core.Appender'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
at ch.qos.logback.classic.gaffer.ConfigurationDelegate.appender(ConfigurationDelegate.groovy:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(MixinInstanceMetaMethod.java:53)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:308)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
However, when I switch to equivalent XML configuration, everything works. What am I doing wrong?
Using Logback 1.0.0. Tried with Logback 1.0.3.
I figured the solution out, but some questions remain opened. The problem was that I had no proper Groovy on the classpath. I decided to make an example project to demonstrate this bug. I started with a console application using Gradle's "application" plugin. I didn't include Groovy as dependency.
apply plugin: 'application'
repositories {
mavenCentral()
}
ext.logbackVersion = '1.0.3'
ext.slf4jVersion = '1.6.4'
dependencies {
compile "ch.qos.logback:logback-classic:$ext.logbackVersion"
compile "org.slf4j:jcl-over-slf4j:$ext.slf4jVersion"
//runtime "org.codehaus.groovy:groovy:1.8.6" // the problem was here
}
mainClassName = "org.test.Main"
This gave me an error, which is quite straighforward.
|-ERROR in ch.qos.logback.classic.LoggerContext[default] - Groovy classes are not available on the class path. ABORTING INITIALIZATION.
OK, cool. The dependency was missing - easy to fix. But why didn't I get the same error when I ran my web application? Adding Groovy dependency solved the initial problem in the web application. I stripped my project down and will create a corresponding JIRA. Perhaps, Groovy on classpath detection is not quite correct.
The GroovyCastException "cannot cast ConsoleAppender as Appender" has all the bearings of a class loader issue. Which version of groovy is this? Could you open a bug report including a test case for reproducing this issuew?
colleagues.
I have faced almost the same trouble today:
When I use logback.xml everything works fine
When I use logback.groovy in IntelliJ IDEA eveything works fine too
When I use logback.groovy when start my script from command line I got a lot of errors like
:
D:\Projects\PRDMonitoring\sources>groovy tray.groovy PRD
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 2: unable to resolve class ch.qos.logback.classic.filter.LevelFilter
# line 2, column 1.
import ch.qos.logback.classic.filter.LevelFilter
^
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.encoder.PatternLayoutEncoder
# line -1, column -1.
Script1.groovy: 3: unable to resolve class ch.qos.logback.core.ConsoleAppender
# line 3, column 1.
import ch.qos.logback.core.ConsoleAppender
^
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
# line -1, column -1.
Script1.groovy: 6: unable to resolve class ch.qos.logback.core.spi.FilterReply
# line 6, column 1.
import static ch.qos.logback.core.spi.FilterReply.ACCEPT
^
Script1.groovy: 7: unable to resolve class ch.qos.logback.core.spi.FilterReply
# line 7, column 1.
import static ch.qos.logback.core.spi.FilterReply.DENY
But after a couple of minutes to find a solution I figured out, that the following string before #Grapes annotation fixes a trouble with classes loading #GrabConfig(systemClassLoader=true)
#GrabConfig(systemClassLoader=true)
#Grapes([
#Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.6'),
#Grab(group = 'org.apache.commons', module='commons-lang3', version='3.0'),
#Grab(group = 'commons-io', module = 'commons-io', version = '2.4'),
#Grab(group = 'joda-time', module = 'joda-time', version = '2.9.4'),
#Grab(group = 'ch.qos.logback', module = 'logback-classic', version = '1.1.7'),
#Grab(group = 'ch.qos.logback', module = 'logback-core', version = '1.1.7')
])