E
E
Evgeny Ivanov2018-07-27 10:20:53
Preprocessors
Evgeny Ivanov, 2018-07-27 10:20:53

Why was scss, sass, less, etc invented?

I started researching this topic. In general, it's interesting.
On the one hand, css is not a programming language (yes, cascading styles, etc.), on the other hand, it is already trying to calculate something there (calc).
What it looks like and drew the attention of Qt by creating QML (Qt Meta Language or Qt Modeling Language) - a declarative programming language based on JavaScript, but very similar in semantics to css.
(That is, they kind of hinted where the css path will go next.)
So, as I understand it, preprocessors use the sass, less, scss language (many of them), converting the code into a css file.
This raises a general question.
Why was scss, sass, less, etc invented?
After all:
1) just do css (by analogy, as already done in Qt) - a programming language. Logical and convenient.
2) if "you can't just take it and make it" css as a programming language, then we make a css preprocessor for javascript for example.
Why reinvent the wheel of sass, less, stylus when there is already a programming language recognized by millions? There are already many good, full-fledged programming languages, why invent something else?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Moskus, 2018-07-27
@Moskus

You are mistakenly trying to fit things whose function you do not understand well into the framework of your own ideas, which are based on fantasies.
CSS is a style description language for HTML markup. It performs the function of separating the design from the markup. It is not a programming language by any criteria, because it does not describe the logic (algorithm), but only describes the display properties.
QML is an interface modeling language that includes both markup and design. Because in the task it solves, it is not necessary to separate markup from design, as in web. QML has nothing to do with "where the CSS path will go" - they have different tasks. QML is much closer to programming languages ​​because it contains specialized logic.
SASS, LESS, and so on are CSS syntax extensions that are designed to make it easier to edit styles using some forms of syntax that are not found in CSS and that are borrowed from programming languages ​​(variables, for example). They may contain a bit more logic than CSS, but that logic is also just styling. The task of separating design, markup and logic continues to be performed. And, for example, a person who is completely unfamiliar with programming can easily edit styles in the extended LESS syntax, just like he worked with CSS. Making CSS a "programming language" is illogical and inconvenient, and most importantly, it's not necessary. And, surprise, LESS etc. can be converted on the fly to CSS by a JS preprocessor.

S
sim3x, 2018-07-27
@sim3x

When they did sass - zhs was not on the backend

A
Alexander, 2018-07-27
@alexr64

1) just make css a programming language. Logical and convenient.

And the vast mountain of software and / or end devices becomes Deprecated.
So. You can even collect styles in the browser. Users will thank you once again.
Because they wanted to automate writing and copy-pasting styles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question