I use the variable.less configuration file to store all relevant project information. One of the information is the breakpoint between the layout and the layout of the PC. I also need this information in javascript, and I did not know how to get it (without storing it in the data attribute, because I wanted to save all the design variables in one file).
So, I finally found that: I save the breakpoint in .less variables:
@bk-point: "500px";
I use the css property "content", but not on the pseudo-element, but on any tag (smaller than the file):
#any-div { content: "@{bk-point}"; }
Similarly, this does not affect the design (the "content" property is not displayed on the element, only on the pseudo-element), and I can get it very easily with jQuery:
var bkPoint = $('#any-div').css('content');
And all my variables are in fewer files.
This is great for what I want, but is there a side effect that I don't see? Is this bad practice for reasons I cannot imagine?
Thanks for your advice!
Sebastien.
PS:
1. works in firefox 21.0 and in chrome 27.0
2. and of course, if you have a better solution ...
source share