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

Writing standard CSS property names breaks the code parsing process #3

Closed
cfuendev opened this issue Feb 4, 2023 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@cfuendev
Copy link
Owner

cfuendev commented Feb 4, 2023

While testing the ideas mentioned in #2, I also found out that cursor:pointer is being transpiled as cursor: pointer: because the cursor and pointer css properties are overlapping.

image

@cfuendev cfuendev self-assigned this Feb 4, 2023
@cfuendev cfuendev added the bug Something isn't working label Feb 4, 2023
@cfuendev
Copy link
Owner Author

So turns out the real problem is that the code snippet that shoved standard property names property names that aren't registered as Imba shorthand to the final code formatting step (The step that puts property names behind colons : and property values in-between colons : and semicolons ;) wasn't in the right place and, instead of being the final case after the property name wasn't found in the list of shorthands, it was placed inside the if statement that verifies that there's a shorthand for the parsed property name, completely undermining the reason why that snippet exists in the first place.

In case you want to take a look, this is the if statement. It's line 495 on the twimba.js file of the current commit (b9f6e9b)

if (propertyNameRule) {

That if statement makes sure that there is a shorthand rule for the text that's currently in the buffer during the parsing process and, if there is none, it should then look for it on the custom property value rules (Basically anything that transpiles into more than one property, think of d:vflex, display:hgrid, px, margin-y, etc. with the exception of easing properties, which are handled differently and were an absolute pain in the back-end to get working).

So instead of putting the code snippet that should be a fallback to shoving whatever has been parsed as the property name if there is no known shorthand for it (Which would be the case if you're simply writing background or, the property that created this issue, cursor) outside of the if statement (Which is the entire point of the snippet, being outside of that if statement), I left it inside the if statement by accident, probably during one of the fever dreams that building the macro for the first time put me through.

I will change the name of the issue to reflect the actual nature of the bug.

@cfuendev cfuendev changed the title 'Cursor' and 'Pointer' properties overlap Writing standard CSS property names breaks the code parsing process Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant