Skip to content

Keywords should not show in arglist #1192

@jakob-e

Description

@jakob-e

Ruby Sass and LibSass seems to be handling arglist and keywords quite differently.
I don't think the keyword function is supported by LibSass yet – but that aside
keywords should not show in the arglist.

The following tests were done on sassmeister using
LibSass 3.2.0-beta.6 and Ruby Sass 3.4.13

@mixin test($arglist...){
  /*#{inspect($arglist)}*/
}

// Works
@include test(foo, bar, baz);
// Ruby Sass:  /*foo, bar, baz*/ 
// LibSass  :  /*foo, bar, baz*/ 

// LibSass does not inspect as ()
@include test;
// Ruby Sass:  /*()*/                        
// LibSass  :  /**/  

// Ruby Sass throws error – LibSass shows keywords in arglist 
// (keywords should not show in arglist – see below) 
@include test(foo, bar, baz, $keyword: keyword);  
// Ruby Sass:  "Mixin test1 doesn't have an argument named $keyword." 
// LibSass  :  /*foo, bar, baz, $keyword: keyword*/

In order to test the last example in Ruby Sass we need to map the arglist using the keyword function.

@mixin test($arglist...){
  $map: keywords($arglist);
  /*#{inspect($map)}*/
  /*#{inspect($arglist)}*/
}

@include test(foo, bar, baz, $keyword: keyword);  
// Ruby Sass:  
// inspect($map)    : /*(keyword: keyword)*/
// inspect($arglist): /*foo, bar, baz*/*

// LibSass  :  
// inspect($map)    : /**/
// inspect($arglist): /*foo, bar, baz, $keyword: keyword*/


Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions