What is the principle of compiling sass and less into css?

in the interview two days ago, the interviewer asked me this question. I did not find the answer myself, nor did I think of how to describe the question. I would also like to ask the passing god to answer it. What should I do if I am asked during the interview what is the principle of compiling sass and less into css?

May.22,2021

I think it's best to answer compilation principles directly. The simplest and most straightforward answer to
is that it can be implemented with string substitution. According to the css syntax specification, replace sass and less with css : F (sass) = > css . It would be nice to implement such a string processing function, and how to implement it can be explained by the theoretical knowledge of compilation principle .
A rough personal opinion without going into details.


this is the working schematic diagram of less (provided by the official website): https://go.gliffy.com/go/publ., the steps seem quite complicated.
I don't think the interviewer will ask for too much detail. When it comes to the question that can say AST (abstract syntax tree) and know probably the principle of AST, it will OK

.
Menu