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

SharpScss fails to compile sass files #217

Open
ror3d opened this issue Nov 25, 2021 · 4 comments
Open

SharpScss fails to compile sass files #217

ror3d opened this issue Nov 25, 2021 · 4 comments
Labels
⚠️ Bug Something isn't working as expected

Comments

@ror3d
Copy link

ror3d commented Nov 25, 2021

Trying to port over my current website from a different static generator, I had my CSS source files in SASS (indented format). That produces several errors, such as the one reported in sass/libsass#2638

It seems to be an issue with libsass, which I'm unsure about whether it has been fixed or not. Regardless, the version used of SharpScss seems to be an old one, from 2018, so it might be necessary to update it at some point, hopefully fixing the issue.

@daveaglick
Copy link
Member

If I recall, I tried updating SharpScss at one point and hit some blockers, but maybe there's been a new release since then that'll work. Do you have a small minimal repro SASS file I can use to trigger the errors you were seeing?

@daveaglick daveaglick added the ⚠️ Bug Something isn't working as expected label Nov 29, 2021
@ror3d
Copy link
Author

ror3d commented Nov 29, 2021

Sure, right now to me, creating something like test.sass with the following content

body
    background-color: white

gives error

[ERRO] Assets/Process » ExecuteIf » CacheDocuments » CompileSass » [test.sass => test.sass] Error: Invalid CSS after "": 
expected 1 selector or at-rule, was "body"
    on line 1

@rclanan
Copy link

rclanan commented Apr 4, 2024

I believe the issue here is that libsaas primarily supports SCSS syntax (Sassy CSS) rather than the original, older indented Sass syntax. While the two are similar, the difference is in their use of brackets, semicolons, and colons.

I modified one of the unit tests to take in the content you provided, and it was able to reproduce the error. I updated it to SCSS syntax and it works fine.

I tried with some actual SCSS syntax that didn't mimic the CSS output and it was also able to compile it fine as well.

$primary-color: #3498db;

@mixin box-shadow($x, $y, $blur, $color) {
  -webkit-box-shadow: $x $y $blur $color;
  box-shadow: $x $y $blur $color;
}

.container {
  background: $primary-color;
  padding: 20px;

  .button {
    background: darken($primary-color, 10%);
    @include box-shadow(0px, 0px, 10px, rgba(0, 0, 0, 0.5));
    &:hover {
      background: lighten($primary-color, 10%);
    }
  }
}
.container { background: #3498db; padding: 20px; }

.container .button { background: #217dbb; -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); }

.container .button:hover { background: #5faee3; }

Maybe we can add some documentation explaining that it only supports SCSS syntax or something for future users.

@daveaglick
Copy link
Member

Nice detective work @rclanan - definitely adding some hints about this behavior and (un)supported syntax styles to the docs. I think there's a dedicated page for the Sass module (and if there isn't, there should be) so I'll take a look at adding a little bit there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ Bug Something isn't working as expected
Development

No branches or pull requests

3 participants