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

useShadow: accept the style string as is #57

Closed
osher opened this issue Aug 19, 2018 · 1 comment
Closed

useShadow: accept the style string as is #57

osher opened this issue Aug 19, 2018 · 1 comment

Comments

@osher
Copy link

osher commented Aug 19, 2018

Please consider the following form:

import {Slim} from "slim-js"
import {tag, template, useShadow} from "slim-js/Decorators"

@tag('my-tag')
@template(`
 <div role="main"> 
      my html 
 </div>
`)
@useShadow(`
  div[role="main"] {
      font-weight: bold
  }
`)
class _ extends Slim {}

Keep up the good work.
Thanks :)

@eavichay
Copy link
Member

Thanks for the suggestion.
I think this is a little bit going too far from the standards. The aim of the library is to be "slim" as possible and contain the minimum features.
the useShadow is a true/false just to determine if to create a shadow root when the component is being instantiated.

I would, however, consider adding a @style decorator (and a corresponding get style () {} method to simply add style tags while rendering the template. This can be achieved as an extension, plugin or optional decorator file, without touching the core library.

You are welcome to contribute.

@osher osher closed this as completed Aug 22, 2018
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

2 participants