Leo Javier
Leo Javier

Reputation: 1403

I need to import a remote file into my less document

I'm using: @import "http://example.com/Content/bootstrap.less";

but getting the following error:

Error 7 LESS: optional dependency 'request' required to import over http(s)

any ideas on how to solve this?

Upvotes: 4

Views: 2883

Answers (5)

vaughanos
vaughanos

Reputation: 521

I came across this issue when I was compiling with CodeKit.

For me the solution was changing the syntax from:

@import url("https://...");

to:

@import (css) url("https://...");

I did install also request, but I'm not sure if it made any difference.

Upvotes: -1

SynCap
SynCap

Reputation: 6284

This error occurs when node's LESS compiler try to read remote file. For this purposes it use request, which specified in it's dependencies.

To solve broken dependencies, just update LESS compiler:

npm i -g less

Also can be that npm is needed to be updated too, so npm i -g npm less can cure some hidden leaks.

Tada!

If you don't use request by itself, is no needs to install it separately and in particular - globally!!!

If you still see error warning in your IDE/editor - your IDE is using a separate installation of Node (as "Visual Studio Code" do, and some other too), try to locate it and launch the upgrade in that location.

Upvotes: 1

Arthur Shlain
Arthur Shlain

Reputation: 1099

Try command npm install -g request in console (cmd), its helps for me.

Upvotes: 7

Matheus Abreu
Matheus Abreu

Reputation: 3457

Open Terminal/Console and install request dependency globally:

npm install -g request

Upvotes: 4

waheed
waheed

Reputation: 164

Looks like it is less problem to interpret the url correctly. Following url is working fine on live less preview site (version 2.5.3) but its not working in my netbeans IDE's less file (with same version). Less Preview

@import url(https://raw.githubusercontent.com/StatusPage/custom-html-css/master/custom-less.css.less);

Upvotes: 0

Related Questions