DioxusLabs / DioxusLabs/dioxus

Sass is incorrectly compiled

Open
#4,078 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

When using a SCSS file which uses the Sass version of Bulma (version 1.0.0) as an asset, several styling issues occur. For example:

- Buttons lack rounded corners (see screenshot below).
- Modal overlays do not have a dark background and do not cover the full screen.
- Several elements have wrong margins and padding.

When the same SCSS is compiled using Dart Sass, the resulting CSS renders correctly without these issues.

**Steps To Reproduce**

The reproducer is based on the PWA example (tag v0.6.3). Only added and changed files are shown:

`public/main.scss`:

```sass
@use "path/to/bulma/sass"
```

`src/main.rs`:

```rust
use dioxus::prelude::*;

fn main() {
dioxus::launch(app);
}

const MAIN_CSS: Asset = asset!("/public/main.scss");

fn app() -> Element {
rsx! (
document::Link { rel: "stylesheet", href: MAIN_CSS }

div {
class: "container py-4",
div {
class: "field has-addons",
p {
class: "control",
button { class: "button is-primary", "A" }
}
p {
class: "control",
button { class: "button", "B" }
}
}
}
)
}
```

The page served by `dx serve` looks as follows:

![Image](https://github.com/user-attachments/assets/a7e9004d-d916-47e1-8b28-1737b26aec6e)

**Expected behavior**

The page served by `dx serve` looks as follows:

![Image](https://github.com/user-attachments/assets/a2c47275-83d9-48b8-8cbe-6914b7093a7c)

This is the case if the SCSS file is compiled with Dart Sass:

```console
$ sass public/main.scss public/main.css
```

And the `MAIN_CSS` asset is replaced by `asset!("/public/main.css")`.

**Environment:**

- Dioxus version: 0.6.3
- Rust version: 1.85.0
- OS info: Arch Linux
- App platform: web

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.