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

Initial release checklist #1

Closed
9 tasks done
43081j opened this issue Nov 9, 2021 · 5 comments
Closed
9 tasks done

Initial release checklist #1

43081j opened this issue Nov 9, 2021 · 5 comments

Comments

@43081j
Copy link
Owner

43081j commented Nov 9, 2021

This is an attempt at implementing a custom syntax for PostCSS, primarily so we can use stylelint against lit projects.

Before it is usable, here's what is to do:

Any help with this will be appreciated, the location info will be the pain point i think. i've been down that road before with lit's eslint plugin, fun but insane...

I left a console.log in the main file right now to test parsing a string, too. FYI

cc

@jeddy3 - since your reply in the other issue today, this is where i got to. still a way to go but maybe you can let me know if its the right direction

@bennypowers @abdonrd you may be interested too

@stramel if you're curious 😂

@43081j
Copy link
Owner Author

43081j commented Nov 9, 2021

Location info correction

We have a location info correction walker here.

Its purpose is to correct a PostCSS location by offsetting it with the original JS location it came from.

For example, if our css template is 10 lines into the JS file, we need to offset all of our PostCSS locations by 10 lines.

This is already implemented (though untested).

However, we will have incorrect locations when expressions are used:

css`
  .foo { color: ${'blue'}; }
`;

Will become:

  .foo { color: /* PLACEHOLDER */ }

Which means the end position of this stylesheet will be off by PLACEHOLDER_LENGTH - EXPR_LENGTH.

This only matters for end positions, I think. We need to think of some way to correct the line and column based on any expressions that were in there originally (expressions can be multi-line).

@jeddy3
Copy link

jeddy3 commented Nov 13, 2021

since your reply in the other issue today, this is where i got to. still a way to go but maybe you can let me know if its the right direction

I'm afraid I don't know much about writing syntaxes.

My only suggestion is calling this postcss-lit and making it specific to lit templates. The postcss-css-in-js was monolithic, but there's too much diversity in the css-in-js libraries for it to be sustainable. There's probably less diversity in template literal libraries, but still some. You may find it useful to limit the scope of the syntax.

@43081j
Copy link
Owner Author

43081j commented Nov 16, 2021

no worries, i'll figure it out. i've gone ahead and renamed the package too.

finally got the location resolution working, too 🙌

@43081j
Copy link
Owner Author

43081j commented Nov 20, 2021

for anyone lurking:

all of this is done now. once postcss/postcss#1675 is merged, i can merge the remaining PRs and publish.

some similar postcss syntaxes do exist, but i figure its nice to have a lit-specific one anyway we can keep more focused and maintained.

it works as a postcss syntax and a stylelint syntax just fine

@43081j
Copy link
Owner Author

43081j commented Nov 25, 2021

everything is merged, will publish tonight. closing this now 👍

@43081j 43081j closed this as completed Nov 25, 2021
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

No branches or pull requests

2 participants