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

Error getting started with LESS #579

Closed
logankilpatrick opened this issue Mar 27, 2022 · 1 comment
Closed

Error getting started with LESS #579

logankilpatrick opened this issue Mar 27, 2022 · 1 comment

Comments

@logankilpatrick
Copy link

I am following the example right from the docs, I include less in my HTML head tag:

<link href="style.css" rel="stylesheet">
<link rel="stylesheet/less" type="text/css" href="custom.less" />
<script src="https://cdn.jsdelivr.net/npm/less@4" ></script>

and then define a file, custom.less with the following:

@width: 10px;
@height: @width   10px;
@color: #900;

#header {
  width: @width;
  height: @height;
}

as per the example from the docs. But I get no content rendering on my page anymore, it stops working: \

[Error] Cross origin requests are only supported for HTTP.
	doXHR (less@4:10:136005)
	(anonymous function) (less@4:10:136665)
	Promise
	loadFile (less@4:10:136447)
	d (less@4:10:143278)
	m (less@4:10:143886)
	(anonymous function) (less@4:10:144955)
	Promise
	(anonymous function) (less@4:10:144738)
	(anonymous function) (less@4:10:145916)
	(anonymous function) (less@4:10:197)
	Global Code (less@4:10:200)
[Error] XMLHttpRequest cannot load file:///Users/logankilpatrick/Desktop/DGMD-E20/Assignment 2/custom.less due to access control checks.
	doXHR (less@4:10:136005)
	(anonymous function) (less@4:10:136665)
	Promise
	loadFile (less@4:10:136447)
	d (less@4:10:143278)
	m (less@4:10:143886)
	(anonymous function) (less@4:10:144955)
	Promise
	(anonymous function) (less@4:10:144738)
	(anonymous function) (less@4:10:145916)
	(anonymous function) (less@4:10:197)
	Global Code (less@4:10:200)
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'p.href')
	(anonymous function) (less@4:10:145006)
	(anonymous function) (less@4:10:143826)
	promiseReactionJob
[Error] Failed to load resource: the server responded with a status of 404 () (less.min.js.map, line 0)

Any suggestions to resolve this?

@iChenLei
Copy link
Member

@logankilpatrick You open the .html as file by browser directly ? Please use server to hosting your html file. If you develop you project at local machine. you can use follow solutions to create a simple server.

## python2
python -m SimpleHTTPServer

## python3
python3 -m http.server

## PHP
php -S localhost:8000

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

No branches or pull requests

2 participants