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

Short syntax string parameter for directives #6085

Open
sondh0127 opened this issue Mar 14, 2021 · 1 comment
Open

Short syntax string parameter for directives #6085

sondh0127 opened this issue Mar 14, 2021 · 1 comment

Comments

@sondh0127
Copy link

Is your feature request related to a problem? Please describe.
I try using integrate the third library (specifically, https://github.com/tw-in-js/twind) using svelte use:action, and the parameters pass to action is usually a string, in order to use directive I have to wrap the param in a bracket {} and a quote ''. It seems much more than we actually need use:action={'mystring-params'}

	function tw(node: HTMLElement, twClass: string) {
		node.className = twind(twClass)
		return {
			update(twClass: string) {
				node.className = twind(twClass)
			},
			destroy() {},
		}
	}
	<div use:tw={'flex items-center justify-center'}>

Describe the solution you'd like
It would be nice if svelte can support passing literal string params in the directive. Something like

	<div use:tw="flex items-center justify-center">

How important is this feature to you?
In addition to the convenience short syntax, for example, I can take advantage of Tailwind IntelliSense.

image
image

@sondh0127 sondh0127 changed the title Short syntax directive for string parameter Short syntax string parameter for directives Mar 14, 2021
@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants