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

modifyVars does not work is data image #2681

Closed
no-more opened this issue Sep 3, 2015 · 2 comments
Closed

modifyVars does not work is data image #2681

no-more opened this issue Sep 3, 2015 · 2 comments

Comments

@no-more
Copy link

no-more commented Sep 3, 2015

Hi,

I have an error when trying to pass an encoded base64 image variable in less with modifyVars.

Something like:

var newConfig = {"html_backgroundImage": "data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"};
less.modifyVars(newConfig);

will generate this error :

Uncaught (in promise) LessError:
callExtract: undefined
callLine: NaN
column: 27
extract: Array[3]
filename: "http://client.tbook.test/css/theme.less"
href: "http://client.tbook.test/css/theme.less"
index: 13256
line: 663
message: "Unrecognised input"
stack: undefined
type: "Parse"

Thanks a lot.

@seven-phases-max
Copy link
Member

It's the same mistake as in #2372. When you supply a string to modifyVars you need double set of quotes: first quotes for JS and second for Less. (Otherwise your call results in
@html_backgroundImage: data:image/gif;b... which is invalid Less statement of course).

@no-more
Copy link
Author

no-more commented Sep 4, 2015

Thanks a lot, that's it.

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

No branches or pull requests

2 participants