2020-06-16 19:38:30 -04:00
|
|
|
use codemap::Spanned;
|
2020-04-12 19:37:12 -04:00
|
|
|
|
2020-07-08 21:31:21 -04:00
|
|
|
use crate::{error::SassResult, interner::InternedString, value::Value};
|
2020-01-06 16:50:16 -05:00
|
|
|
|
2020-01-08 20:58:02 -05:00
|
|
|
/// A style: `color: red`
|
2020-07-10 00:17:15 -04:00
|
|
|
#[derive(Clone, Debug)]
|
2020-01-20 13:15:47 -05:00
|
|
|
pub(crate) struct Style {
|
2020-07-08 21:31:21 -04:00
|
|
|
pub property: InternedString,
|
2020-06-25 00:27:24 -04:00
|
|
|
pub value: Box<Spanned<Value>>,
|
2020-01-06 16:50:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Style {
|
2020-04-12 19:37:12 -04:00
|
|
|
pub fn to_string(&self) -> SassResult<String> {
|
|
|
|
Ok(format!(
|
|
|
|
"{}: {};",
|
|
|
|
self.property,
|
|
|
|
self.value.node.to_css_string(self.value.span)?
|
|
|
|
))
|
|
|
|
}
|
2020-01-06 16:50:16 -05:00
|
|
|
}
|