SSR guide: add directive transforms
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 3.2k
- Forks
- 5k
- Avg merge
- 14d 17h
- Merged PRs (30d)
- 1
Description
The Documentation for writing SSR Transforms for directives, beside a very basic noop example, is nonexistent. I've written an Image Lazy Loading Directive and want to provide an SSR Transform. adding simple properties like src or poster are working flawless. When it comes to adding a style attribute the lack of documentation makes it very hard find a solution. The transform isn't very complex, but i'm struggling to add style='background-image:url()". See the Transform code below
export const vueLazyLoaderSSRTransform = (dir, node, context) => {
if (node.tag === 'img') {
return {
props: [createObjectProperty('src', dir.exp)]
}
}
if (node.tag === 'video') {
return {
props: [createObjectProperty('poster', dir.exp)]
}
}
return {
props: [
createObjectProperty('style',
createObjectExpression([
createObjectProperty(
'background-image',
createSimpleExpression('url()', true)
)
])
)
]
}
}
It would be great to have a more in depth documentation on SSR Transforms
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing basic noop SSR transform example and the directive transform code included in the issue. Document how SSR directive transforms handle properties such as src, poster, and style, including the reported background-image case; done means a newcomer can follow the guide to implement a comparable transform.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100