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

separate style tag #63

Open
amitguptagwl opened this issue May 24, 2018 · 1 comment
Open

separate style tag #63

amitguptagwl opened this issue May 24, 2018 · 1 comment

Comments

@amitguptagwl
Copy link

Thanks for this useful guide. I found some of the points really helpful. Hence I've a question. As you said that we should separate css style from tag

External stylesheets can be handled by the browser independently of Riot and tag files. This means styles can be applied to initial markup even if JavaScript errors occur or isn't loaded (yet).

Agree. Is it a good idea to reference multiple css files for each tag? (as it is good to have all relevant content of tag in single folder)

External stylesheets can be used in combination with pre-processors (Less, Sass, PostCSS, etc) and your own (existing) build tools.

I'm not sure but I believe server side compilation takes care of that riot foo.tag --style sass

External stylesheets can be minified, served and cached separately. This improves performance.

I also found an option for that riot foo bar --compact

Riot expressions are not supported in nested <style>s so there's no added benefit in using them.

The only reason I combine them with tag so that it is a complete component. Having tag and css in separate tag also solve this purpose. But I don't want to reference multiple files from HTML. Can there be another benefit of that.

The reason I'm raising this issue to clear and improve my undertanding.

@vinyll
Copy link

vinyll commented May 26, 2018

note: If you're using data-is= (introduced in v2.3.17) to initiate Riot tags, you can use [data-is="my-example"] as CSS selector instead of .my-example.

In Riot3 (and before?) you can just use the :scope selector or declare the <style scoped> and it will be transformed to the multiselectors :scoped, .my-example, [data-is="my-example"] {

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