Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing SCSS modulo operator (%) #29

Closed
hcomnetworkers opened this issue Jun 6, 2017 · 2 comments
Closed

Add missing SCSS modulo operator (%) #29

hcomnetworkers opened this issue Jun 6, 2017 · 2 comments
Labels
Milestone

Comments

@hcomnetworkers
Copy link

$component-space: 21px;

@function components-add-margins($bot, $top) {
  // Parameter validation
  @if unit($bot) != "px" or unit($top) != "px" {
    @error "Parameter $bot and $top are expected to be of type 'px'.";
  }

  $sum : ($top + $bot) % $component-space;
  @if $sum <= 0 {
    $sum : $sum + $component-space;
  }
  @return $sum;
}

This error is displayed for the "%" symbol:

Parse error at line 27 column 25: 17: /// 18: /// @param {Number} $bot - Margin in pixels 19: /// @param {Number} $top - Margin in pixels 20: /// @returns {Number} In pixels 21: @function components-add-margins($bot, $top) { 22: // Parameter validation 23: @if unit($bot) != "px" or unit($top) != "px" { 24: @error "Parameter $bot and $top are expected to be of type 'px'."; 25: } 26: 27: $sum : ($top + $bot) % $component-space; ^ 28: @if $sum <= 0 { 29: $sum : $sum + $component-space; 30: } 31: @return $sum; 32: } 33: 34: /// Substracts a margin from the standard margin and takes care that it not results less or equal 0px 35: /// 36: /// This function can handle $sub to be too large or to be negative. 37: /// @example

Sass has no problem with this syntax.

Thank you

@racodond
Copy link
Owner

racodond commented Jun 6, 2017

Hi @hcomnetworkers,

Thanks for your feedback!
I reproduced the error and will fix it in version 4.5.

David

@racodond racodond added the bug label Jun 6, 2017
@racodond racodond added this to the 4.5 milestone Jun 6, 2017
@racodond racodond changed the title Parse error Parse error: add missing SCSS modulo (%) operator Jun 6, 2017
@racodond racodond changed the title Parse error: add missing SCSS modulo (%) operator Add missing SCSS modulo (%) operator Jun 6, 2017
@racodond racodond changed the title Add missing SCSS modulo (%) operator Add missing SCSS modulo operator (%) Jun 6, 2017
@racodond
Copy link
Owner

racodond commented Jun 6, 2017

Version 4.5 is now available at https://github.com/racodond/sonar-css-plugin/releases/tag/4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants