Less is a programming language, or just something more complex than CSS?

Asked

Viewed 636 times

2

Well I believe that Less may not be a programming language, so what is it? where does it rank?

If it really is a programming language what makes it?

  • http://answall.com/q/35547/101 if I am not mistaken has already been closed and removed question about other things that are clearly markup language as duplicate of this. This gives an overview of what is a programming language: http://answall.com/q/102452/101

3 answers

4


LESS is a style sheet language dynamic, but not a programming language - because it is not Turing-complete.

Its main features are:

  • Variables

    @pale-green-color: #4D926F; // Definição de variável
    
    #header {
      color: @pale-green-color; // utilização de variável
    }
    h2 {
      color: @pale-green-color;
    }
    
  • Mixins

    .rounded-corners (@radius: 5px 10px 8px 2px) { // Definição da primitiva
      -webkit-border-radius: @radius;
      -moz-border-radius: @radius;
      border-radius: @radius;
    }
    
    #header {
      .rounded-corners; // Utilização da primitiva
    }
    
  • Style in nesting

    .header {
        p {
            font-size: 16px              // compilado como .header p {...}
            a {
                text-decoration: none;   // compilado como .header p a {...}
                &:hover {
                    border-width: 1px;
                }
            }
        }
    }
    

Browsers do not black out. A LESS file should be interpreted when the code is ready for the target environment, and the result of the interpretation is a standard CSS file that is then made available for consumption.

Source.

  • Programming languages do not have to be Turing complete.

  • @Brunocosta is still the most accepted definition. As it escapes the scope (since LESS does not fit in any of the borderline cases) I preferred the simple approach. For more details: http://answall.com/questions/102452/o-que-caracteriza-uma-linguagem-de-programa%C3%A7%C3%A3o

1

LESS is not a programming language yes a CSS pre-processor as well as SASS.

The purpose of LESS is to extend the capabilities of CSS by adding new features to generate CSS such as mixins, functions and variables - all non-existent CSS features.

The LESS processor takes care of transforming your LESS code into pure CSS to be used in the usual way.

Having doubts about the characteristics of a programming language, visit the link contained in the @Maniero comment in their post.

0

LESS is referenced as a language, it generates CSS from a logic. LESS generates CSS just as PHP ends in HTML. We can not deny that it is more complex, but in favor of less code to do beyond terms less refaction. You can find more details about the features you can use in the documentation examples themselves in the link below.

http://lesscss.org/features/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.