Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Ignore adding scope hash when styles are not scoped #32

Closed
saurabhdaware opened this issue Oct 12, 2020 · 4 comments · Fixed by #34
Closed

Ignore adding scope hash when styles are not scoped #32

saurabhdaware opened this issue Oct 12, 2020 · 4 comments · Fixed by #34
Assignees
Labels
good first issue Good for newcomers

Comments

@saurabhdaware
Copy link
Member

saurabhdaware commented Oct 12, 2020

<AbellComponent>
<template>
  <!-- This code does not need to be scoped -->
  <div></div>
</template>
</AbellComponent>
<AbellComponent>
<template>
  <!-- This code does not need to be scoped -->
  <div></div>
</template>
<style global>
  /* global styles */
</style> 
</AbellComponent>

Problem:
In both of the above cases, CSS is not needed to be scoped. Above components will add abell-data-<hash> attribute to all html elements inside template.

And thus, it outputs:

<div data-abell-kGoBAj></div>

data-abell-<hash> is required to scope CSS. But since in above examples, styles are not scoped, we can ignore adding hash to HTML elements.

Expected:
Component with this code is not required to be scoped so does not need those abell-data attributes. So they are expected to output.

<div></div>

This is the function that adds those hashes to HTML output https://github.com/abelljs/abell-renderer/blob/main/src/parsers/component-parser.js#L158

We have to ignore calling this function if-

  • <style> tag exists and has global attribute
  • <style> tag does not exist

This is a good-first-issue so feel free to ask any additional questions in comments below

@saurabhdaware saurabhdaware added good first issue Good for newcomers and removed good first issue Good for newcomers labels Oct 12, 2020
@saurabhdaware saurabhdaware changed the title Ignore adding scope hash when there is not style tag in abell component Ignore adding scope hash when styles are not scoped Oct 12, 2020
@judicaelandria
Copy link
Contributor

I'll take this

@saurabhdaware
Copy link
Member Author

Go ahead @judicaelandria 🥳

@judicaelandria
Copy link
Contributor

@saurabhdaware
Copy link
Member Author

saurabhdaware commented Oct 29, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants