Answer the question
In order to leave comments, you need to log in
LESS does not work in the browser. What's wrong?
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet/less" type="text/css" href="style.less" />
<script src="less.min.js"></script>
</head>
<body>
<main>
Красный текст
</main>
</body>
</html>
body {
main{
color: red;
}
}
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js"></script>
Answer the question
In order to leave comments, you need to log in
Browsers do not directly accept LESS, only css, so you must first compile LESS into regular css.
There are a bunch of compilers - from a JavaScript script embedded in the page itself to infinity (for example, install via npm: npm install -g less)
Error, these are actually browser security restrictions, in short, so that scripts cannot load anything else when located not on the same domain as the downloaded data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question