hyperide/lib.rs
1extern crate self as hyperide;
2
3pub use hyperide_macro::hyperide;
4
5pub mod htmx;
6pub mod hyperscript;
7pub mod tailwind;
8pub mod vercel;
9
10mod attr;
11pub use attr::IntoAttrText;
12
13mod hyper;
14pub use hyper::HyperText;
15pub use hyper::IntoHyperText;
16
17/// Bakes css from a file into hyperide. Will insert it inside `<style>`
18/// tags and allows you to write styles in a `.css` file but include it in
19/// generated HTML without needing to serve the file separately and causing an
20/// additional request from the client.
21///
22/// ```rust
23/// # use hyperide_macro::hyperide;
24/// hyperide! {
25/// include_style!("foo.css")
26/// };
27/// ```
28#[macro_export]
29macro_rules! include_style {
30 ($file:expr $(,)?) => {{
31 $crate::hyperide! {
32 <style _hr_no_raw=true>
33 { std::include_str!($file) }
34 </style>
35 }
36 }};
37}
38
39/// Bakes javascript from a file into hyperide. Will insert it inside `<script>`
40/// tags and allows you to write javascript in a `.js` file but include it in
41/// generated HTML without needing to serve the file separately and causing an
42/// additional request from the client.
43///
44/// ```no_run
45/// # use hyperide::hyperide;
46/// let my_script = hyperide! {
47/// include_script!("foo.js")
48/// };
49/// ```
50#[macro_export]
51macro_rules! include_script {
52 ($file:expr $(,)?) => {
53 $crate::hyperide! {
54 <script _hr_no_raw=true>
55 { include_str!($file) }
56 </script>
57 }
58 };
59}