Home > Web Front-end > CSS Tutorial > Why Am I Getting an 'Expected Expression' Error When Compiling My Sass File?

Why Am I Getting an 'Expected Expression' Error When Compiling My Sass File?

Patricia Arquette
Release: 2024-11-11 11:28:03
Original
633 people have browsed it

Why Am I Getting an

Sass File Not Generating CSS: "expected expression" Error

When compiling a Sass file to CSS, you may encounter an "expected expression" error. This typically occurs when the Sass syntax is incorrect.

In this instance, the error message indicates that a problem occurred after "80%". Upon examining the provided Sass file, we notice that the file extension is .sass, which is for the _old Sass syntax_. However, the Sass version used (3.1.10) is for the _new SCSS syntax_.

Cause of the Error:

The .sass file extension is used for the original Sass language, which has different syntax rules than SCSS (Sassy CSS). In SCSS, semicolons are not required after declarations, while they are required in the original Sass syntax.

Solution:

To resolve the issue, rename the file with the .scss extension. This will indicate to the Sass compiler that the file uses the SCSS syntax, allowing it to be compiled correctly.

Updated .scss File:

/* style.scss */
#navbar {
  width: 80%;
  height: 23px;
}
Copy after login

The above is the detailed content of Why Am I Getting an 'Expected Expression' Error When Compiling My Sass File?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template