Asignaciones de Sass y sintaxis con sangría

Is there a way to indent Sass' 3.3 mapeos?

In scss we can write following:

$colors: (
  header: #b06,
  text: #334,
  footer: #666777
)

But in Sass I cannot add any break into parentheses. I think that parentheses is required into mappings syntax.

$colors:
    header: #b06
    text: #334
    footer: #666777

Syntax error: Illegal nesting: Nothing may be nested beneath variable declarations.

I tried some variances and nothing was compiled without errors.

To compile Sass I need to write it into one string like this:

$colors: (header: #b06, text: #334, footer: #666777)

But it is not indented syntax.

I think that will be a good walkthrough to write indented-only things into SCSS file and then import them.

preguntado el 22 de mayo de 14 a las 14:05

2 Respuestas

There is number of issues with the indented syntax in SASS.

Desafortunadamente, SASS syntax doesn't support Multi-line. Reading the documentation, there is only one exception, when it comes to multiple CO selectors like in this example:

.users #userTab,
.posts #postTab
    width: 100px
    height: 30px

Read the complete documentation here:

http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#multiline_selectors

So, there is no possibility to get multi-line support for an argument list in SASS.

Respondido el 06 de junio de 14 a las 18:06

This is a known issue and will not be addressed any time soon.

This is definitely something I'd like to add, but it would take a considerable amount of effort due to the refactoring of the indented syntax that would be required. Right now that's just lower priority than adding features that benefit everyone.

https://github.com/sass/sass/issues/1088

Respondido el 07 de junio de 14 a las 16:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.