1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pub use crate::css_parser as css;
pub use crate::values as css_values;
use crate::css_parser::{Location, PrintErr, Printer};
pub use crate::css_parser::Error;
/// @tailwind
/// https://github.com/tailwindlabs/tailwindcss.com/blob/4d6ac11425d96bc963f936e0157df460a364c43b/src/pages/docs/functions-and-directives.mdx?plain=1#L13
#[derive(Clone, Copy)]
pub struct TailwindAtRule {
pub style_name: TailwindStyleName,
/// The location of the rule in the source file.
pub loc: Location,
}
impl TailwindAtRule {
pub fn to_css(&self, dest: &mut Printer) -> Result<(), PrintErr> {
dest.write_str("@tailwind")?;
dest.whitespace()?;
self.style_name.to_css(dest)?;
dest.write_char(b';')?;
Ok(())
}
pub fn deep_clone(&self, _: &bun_alloc::Arena) -> Self {
*self
}
}
#[derive(Clone, Copy, PartialEq, Eq, css::DefineEnumProperty)]
pub enum TailwindStyleName {
/// This injects Tailwind's base styles and any base styles registered by
/// plugins.
Base,
/// This injects Tailwind's component classes and any component classes
/// registered by plugins.
Components,
/// This injects Tailwind's utility classes and any utility classes registered
/// by plugins.
Utilities,
/// Use this directive to control where Tailwind injects the hover, focus,
/// responsive, dark mode, and other variants of each class.
///
/// If omitted, Tailwind will append these classes to the very end of
/// your stylesheet by default.
Variants,
}
// ported from: src/css/rules/tailwind.zig