less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.02k stars 3.41k forks source link

Use less.js with CDN, there has no idea to resovle the error " Inline JavaScript is not enabled. " #3478

Closed adamma1024 closed 4 years ago

adamma1024 commented 4 years ago

I use less with CDN

<script src="https://cdn.jsdelivr.net/npm/less@3.11.1/dist/less.min.js"></script>

But I can't compile the .lessfile which include inline js

image

I don't want to use dynamic compile package like webpack.

How can I do.

matthew-dean commented 4 years ago

This should work:

<script>
less = { javascriptEnabled: true }
</script>
<script src="https://cdn.jsdelivr.net/npm/less@3.11.1/dist/less.min.js"></script>
matthew-dean commented 4 years ago

Note that any JS within your .less files will be eval'd. For this reason, inline JS is disabled by default as a security precaution.