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

Remove the stylesheet component #3176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/document/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub trait Document: 'static {
// The style has a src, render it as a link tag
(Some(_), _) => {
attributes.push(("type", "text/css".into()));
attributes.push(("rel", "stylesheet".into()));
self.create_head_element("link", &attributes, None)
}
// The style has neither contents nor src, log an error
Expand Down
2 changes: 0 additions & 2 deletions packages/document/src/elements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use dioxus_core_macro::*;

mod link;
pub use link::*;
mod stylesheet;
pub use stylesheet::*;
mod meta;
pub use meta::*;
mod script;
Expand Down
6 changes: 5 additions & 1 deletion packages/document/src/elements/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl StyleProps {
}
}

/// Render a [`style`](crate::elements::style) tag into the head of the page.
/// Render a [`style`](crate::elements::style) or [`link`](crate::elements::link) tag into the head of the page.
///
/// If present, the children of the style component must be a single static or formatted string. If there are more children or the children contain components, conditionals, loops, or fragments, the style will not be added.
///
Expand All @@ -57,6 +57,10 @@ impl StyleProps {
/// }}
/// "#
/// }
/// // You could also use a style with a href to load a stylesheet asset
/// document::Style {
/// href: asset!("/assets/style.css")
/// }
/// }
/// }
/// ```
Expand Down
31 changes: 0 additions & 31 deletions packages/document/src/elements/stylesheet.rs

This file was deleted.

Loading