- Notifications
You must be signed in to change notification settings - Fork147
fix: remove preprocessor-specific attributes#653
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
- global for style tags- src for script/style tagsfixes#652
| /** Add a custom language preprocessor*/ | ||
| potatoLanguage({ content, filename, attributes }) { | ||
| const {code,map }=require('potato-language').render(content); | ||
| const {src,...cleanedAttributes }= attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this example does not make sense as i assume potato-language uses the lang attribute value.
If you want to show it here, the preprocessor would have to use a custompotato attribute that then gets filtered
| }; | ||
| }; | ||
| exportconstremoveSrcAttribute=(attributes:Record<string,any>)=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
should this be a generic util?
exportconstfilterAttributes(attributes:Record<string,any>,filterFn:(a:string)=>boolean){returnObject.fromEntries(Object.entries(attributes).filter(([a])=>filterFn(a)))}
usage:
constcleanAttributes=filterAttributes(attributes,a=>a!=='src');// orconstattributesToRemove=['foo','bar'];constcleanMultipleAttributes=filterAttributes(attributes,a=>!attributesToRemove.includes(a))
that can be reused for global and potentially others?
fixes#652
@dominikg does this fix the v-p-s issue?
Before submitting the PR, please make sure you do the following
pnpm lint!)Tests
npm testorpnpm test