The question is clearly understood from the title; in order not to leave the question text field empty, I will say why I need it. It is necessary to ensure that the same variables are available in both JavaScript
and LESS
(and therefore CSS
).
This approach can be applied, for example, with cross-platform layout, when you not only change the style through CSS
media queries, but also change the layout as a whole, manipulating the DOM
through JS
; In this case, it is convenient to set the minimum and maximum values of the phases (window widths at which the layout does not change) in the JSON
file, which will be read as LESS
for the formation for media queries, and JS
. T. o. JSON
will play the role of the configuration file.
gulp
: npmjs.com/package/gulp-less-json-variables - Vladimir Gamalyan