Hello.

Interested in the possibility of automatic conversion to other units of measurement using parameterized variables. For example, a variable of type @value () is created , and when you type a value in px in parentheses, it gives the result to rem in the property in which it is specified. Something like:

.block { width: @value(100); } 

After compiling:

 .block { width: 6.25rem; } 

The use of mixins allows you to determine only specific properties, but I am interested in the possibility of precisely universal application.

There is a similar question on the English-language stack, they cite the code that makes such transformations, but I still do not understand where to insert it.

  • Somewhere to styles. And all the dimensions are replaced by calls to this function. - D-side
  • Somewhere - not quite specifically. Is it possible to read more? - BigKompot
  • Oh, sorry, I was a little stuck in the world of Sass, I thought that there was also a syntax for defining functions. As it turned out, no. They write that you need to add it to the LESS build settings, where they are located - depends on the build system, there is an example for grunt-contrib-less , what is yours? - D-side
  • I use gulp. - BigKompot

0