SomMeri / less4j

Less language is an extension of css and less4j compiles it into regular css. Less adds several dynamic features into css: variables, expressions, nested rules, and so on. Less was designed to be compatible with css and any correct css file is also correct less file.
145 stars 47 forks source link

Update data-uri function to disable ieCompat or modify upper limit of base64 encoded max length #331

Closed danhyun closed 8 years ago

danhyun commented 8 years ago

Currently less4j is strictly ie8 compatible: https://github.com/SomMeri/less4j/blob/2e280d3bc2bc788753796edd491022f34bef23e9/src/main/java/com/github/sommeri/less4j/core/compiler/expressions/MiscFunctions.java#L315

Data-uri function should be updated to match less.js implementation:

https://github.com/less/less.js/blob/9d332a72ec0c43516492164d80b0db5851eca2f4/lib/less/functions/data-uri.js#L75

        var DATA_URI_MAX = 32768;
        if (uri.length >= DATA_URI_MAX) {

            if (this.context.ieCompat !== false) {
                logger.warn("Skipped data-uri embedding of " + filePath + " because its size (" + uri.length +
                    " characters) exceeds IE8-safe " + DATA_URI_MAX + " characters!");

                return fallback(this, filePathNode || mimetypeNode);
            }
        }
SomMeri commented 8 years ago

The configuration object has now ieCompatibility property. If you set it to false, data-uri check will be turned off.

This will be available after next release, probably tomorrow.

danhyun commented 8 years ago

:D :D thanks so much! On Feb 18, 2016 9:21 AM, "Mária Jurčovičová" notifications@github.com wrote:

The configuration object has now ieCompatibility property https://github.com/SomMeri/less4j/blob/34e9e3369e0355ea14ec66607a48a7077958e6ec/src/main/java/com/github/sommeri/less4j/LessCompiler.java#L123-L139. If you set it to false, data-uri check will be turned off.

This will be available after next release, probably tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/SomMeri/less4j/issues/331#issuecomment-185743158.