Is it possible to declare LESS variables in the HTML and use the declared vars in a seperate .less file.
I want to do something like this:
<html>
<head>
<style type="text/less">
@MYVAR: #9BC509;
</style>
<!-- use MYVAR inside the main.less file -->
<link rel="stylesheet/less" type="text/css" href="styles/less/main.less">
</head>
...
</html>
EDIT:
Since this did not work and was not a clean solution, I restructured my project, and now do a normal less file @incude
for the variables I need. The less file is dynamically written to disc with database values by the django templating engine (and chached for better performance).
To all the downvoters. I don't really get your point! You didn't even write why you downvoted. I case you did not get what I was aiming for, here is the question I should have asked for "slow-thinkers":
How can I achieve including less variables declared in the <head></head>
to be available in a seperate less file? But anyways this is just for people hitting this post at some point... As I said I chose another solution.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…