alexo / wro4j

New project location is:https://github.com/wro4j/wro4j
442 stars 110 forks source link

Error with v1.6.3 and CSS data URLs #105

Closed redking closed 11 years ago

redking commented 11 years ago

Hey,

Since upgrading to v1.6.3, less files that contain base64 encoded data uris are no longer processed.

For example, if I add a file with the following content to a wro package, the compilation will fail

.test {
background:url(data:image/gif;base64,R0lGODlhBQALAIAAAP7//6a9zyH5BAkAAAAALAAAAAAFAAsAAAILDBx4mrfeEJuQogIAOw==) no-repeat 50% 50%;
}

The exception outputted to the console is

ERROR ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorator-process:65 - Failed to process the resource: ro.isdc.wro.model.resource.Resource@17a22c0[CSS,app-dashboard,true] using processor: ro.isdc.wro.extensions.processor.css.LessCssProcessor@1710dc0. Reason: Error in LESS: SyntaxError: expected ')' got '''

(the character after 'got' depends on the file that has provoked the exception)

The package is successfully built when this file is removed, or when v1.6.2 is used.

I've tried quoting the url content and putting it in a variable but it doesn't help, and I can find nothing in the lessc docs or issues on github that suggests there has been a change in syntax.

Any ideas ?

The compilation is using the Node processor, and I have lessc 1.3.3 installed.

alexo commented 11 years ago

The processor fails only if the underlying less compiler fails. I'll check just to be sure if the lessc is the problem. In the meantime, you can either switch to rhinoLessCss or less4j processors.

redking commented 11 years ago

The same lessc compiler is used whether I use wro 1.6.2 or 1.6.3 though, is that right ? So why would less compilation fail in one version and not in the other ? The only change I made between tests is to update wro4j (leaving node lessc and the less source file untouched).

Thanks for taking a look at this though! Unfortunately I can't use the other processors, as developers here need the speed of the Node processor. I was hoping to benefit from the improved less logging in 1.6.3, but I can revert to the previous version for the moment.

alexo commented 11 years ago

The less4j processor is really fast. You could try it... also there is the stable 1.0.0 version available.

alexo commented 11 years ago

And yes, you are right. As long as the same lessc version works with wro4j 1.6.2 and fails with 1.6.3, there is something wrong with wro4j. I'll investigate this.

Thanks for reporting.

alexo commented 11 years ago

@redking Could you provide the following details:

redking commented 11 years ago

Hey,

The pre-processors are

cssVariables,cssImport,semicolonAppender

post-processors

lessCss

The CSS I posted above is the minimum to reproduce i.e. If I reduce a css file to only that line, it will not compile. If I replace the line with a simple CSS rule, it will compile.

alexo commented 11 years ago

Fixed in branch 1.6.x