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

@import remote stylesheets does not work on 3.12.0 #3541

Closed
zaquest opened this issue Jul 14, 2020 · 7 comments
Closed

@import remote stylesheets does not work on 3.12.0 #3541

zaquest opened this issue Jul 14, 2020 · 7 comments

Comments

@zaquest
Copy link
Contributor

zaquest commented Jul 14, 2020

Seems like 3.12.0 broke imports for remote stylesheets. For example

@import "https://raw.githubusercontent.com/less/less.js/master/packages/test-data/less/visitorPlugin/visitor.less";

.h1 { font-size: 1px; }

compiles on 3.11.3, but on 3.12.0 it throws

SyntaxError: The "url" argument must be of type string. Received an instance of Object in /.../test_less_remote_import.less on line 1, column 1:
1 @import "https://raw.githubusercontent.com/less/less.js/master/packages/test-data/less/visitorPlugin/visitor.less";

Is this a bug or was the support for remote imports dropped?

@mpibpc-mroose
Copy link

👍 I can reproduce this issue with an unmodified bootswatch "template".

SyntaxError: The "url" argument must be of type string. Received type object in /source/assets/css/bootswatch.less on line 5, column 1:
4
5 @import url(https://fonts.googleapis.com/css?family=Ubuntu);
6

@hitesh-sourcefuse
Copy link

Referenced pull request ##3501

@matthew-dean
Copy link
Member

@hitesh-sourcefuse Hmm, so maybe the replaced library wasn't a drop-in replacement.

@KieranMcCool
Copy link

Also worth noting that where url(https://someurl/somestylesheet.css) was valid before, the quotations are now required. I had legacy code from years ago start erroring today. This release has breaking changes and devs should be notified.

@hitesh-sourcefuse
Copy link

@matthew-dean to fix this issue following file lib/less-node/url-file-manager.js needs changes as from
request.get({uri: urlStr, strictSSL: !options.insecure }, (error, res, body) => {
to
request.get(urlStr, (error, res, body) => {
because native-request needs the first param to be a string. Not sure about "strictSSL" options in native-request.

@matthew-dean
Copy link
Member

@hitesh-sourcefuse Can you make a PR with those fixes and tests?

matthew-dean added a commit to matthew-dean/less.js that referenced this issue Jul 15, 2020
@matthew-dean
Copy link
Member

@hitesh-sourcefuse nvm, made a PR

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

Successfully merging a pull request may close this issue.

5 participants