Simone Spagna
Simone Spagna

Reputation: 636

SASS error : Invalid CSS after "": expected media query list, was ""only screen an..."

If I call SASS command as shown below :

call sass C:\Users\simon\source\repos\Pippo\ClickR\\Styles\main.scss C:\Users\simon\source\repos\Pippo\ClickR\\Styles\main.css

i get the following error :

Error: Invalid CSS after "": expected media query list, was ""only screen an..."
    on line 348 of C:/Users/simon/source/repos/Pippo/ClickR/Styles/foundation/components/_top-bar.scss
    from line 22 of C:/Users/simon/source/repos/Pippo/ClickR/Styles/_foundation.scss
    from line 3 of C:\Users\simon\source\repos\Pippo\ClickR\\Styles\main.scss
    Use --trace for backtrace.

Here is the code that generates the error:

_top-bar.scss

....
$topbar-media-query: "only screen and (min-width:"#{$topbar-breakpoint}")" !default;
....
@media #{$topbar-media-query} {
.top-bar {
  background: $topbar-bg;
  @include clearfix;
  overflow: visible;

  .toggle-topbar { display: none; }

  .title-area { float: $default-float; }
  .name h1 a { width: auto; }

  input,
  .button {
    line-height: 2em;
    font-size: emCalc(14px);
    height: 2em;
    padding: 0 10px;
    position: relative;
    top: 8px;
  }

  &.expanded { background: $topbar-bg; }
}
....

How can I solve it?

Upvotes: 0

Views: 1931

Answers (1)

Giuseppe Schembri
Giuseppe Schembri

Reputation: 857

The problem is just a syntax error on the assignment to $topbar-media-query.

You should escape a double quote inside a string or you should use a single quote.

In your example you do not need a string for the CSS property min-width, so the easier thing to do is:

Instead of

$topbar-media-query: "only screen and (min-width:"#{$topbar-breakpoint}")" !default;

Try

$topbar-media-query: "only screen and (min-width:#{$topbar-breakpoint})" !default;

Upvotes: 1

Related Questions