Skip to content

refactor(rules/font_face): change supports to tech#255

Merged
devongovett merged 12 commits intoparcel-bundler:masterfrom
CGQAQ:feat-tech-format
Aug 22, 2022
Merged

refactor(rules/font_face): change supports to tech#255
devongovett merged 12 commits intoparcel-bundler:masterfrom
CGQAQ:feat-tech-format

Conversation

@CGQAQ
Copy link
Contributor

@CGQAQ CGQAQ commented Aug 17, 2022

@CGQAQ CGQAQ marked this pull request as draft August 17, 2022 13:50
@CGQAQ CGQAQ marked this pull request as ready for review August 18, 2022 03:12
@devongovett
Copy link
Member

Thanks, will look closer tomorrow.

But here the error have been ignored again

Yeah, if a property fails to parse, it is stored as raw tokens. This way, if a new feature is added that we don't support yet, we don't fail to parse, it'll just potentially be less optimally minified. I think eventually we might have a strict mode to fail in this case, and we might also emit warnings otherwise.

@CGQAQ CGQAQ force-pushed the feat-tech-format branch 3 times, most recently from baff794 to 59afc6d Compare August 18, 2022 11:27
@yisibl yisibl force-pushed the feat-tech-format branch 2 times, most recently from 5c94198 to 1a0a041 Compare August 18, 2022 12:49
@CGQAQ
Copy link
Contributor Author

CGQAQ commented Aug 18, 2022

I think it's ready to merge, please take a look

location: input.current_source_location(),
});
}
}
Copy link
Member

@devongovett devongovett Aug 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could these errors ever happen? format_location will always be less than tech_location since you already parsed it before if it exists.

Comment on lines +169 to +170
let tech_len = self.tech.len();
if tech_len > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let tech_len = self.tech.len();
if tech_len > 0 {
if !self.tech.is_empty() {

Comment on lines 173 to 178
for i in 0..tech_len {
self.tech[i].to_css(dest)?;
if tech_len - 1 != i {
dest.write_char(',')?;
}
technology.to_css(dest)?;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do self.tech.to_css(dest)?; here - Vec implements the ToCss trait if its contents does.

serde(tag = "type", content = "value", rename_all = "kebab-case")
serde(tag = "type", content = "value")
)]
pub enum FontTechnology {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably use the enum_property macro to simplify this if you want. It would implement Parse and ToCss for you.

@devongovett devongovett merged commit 6a2bc1d into parcel-bundler:master Aug 22, 2022
@yisibl yisibl deleted the feat-tech-format branch August 22, 2022 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support the new tech() and format() syntax in @font-face

3 participants