1.0.50 • Published 2 years ago

sandeep49g-web-component1-demo v1.0.50

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

🚀 Web Component Demo

This project has been created using webpack-cli, you can now run

npm run build

or

yarn build

to bundle your application

Ways to share styles with web component:

  1. CSS variables Pros: We can have default css property inside web component Cons: Lot of CSS properties need to provide individually, can be time consuming

  2. ::part(some-box) // some-box is part name in template of web component For Ex: In user-card web component: some box In consumer CSS: user-card::part(some-box) {...} Pros: We can have default css properties for whole group We can have lot of CSS properties together in single group, much better than first approach (CSS variables)

  3. slot tag in web component, we can style from outside for that slot (Slot is not a part of shadow root if template is coming from outside, default template of slot will bepart of shadow root) For Ex: In user-card web component: and CSS: ::slotted(div.slot-email) {...} In consumer: abc@xyz.com In consumer CSS: .slot-email {...} Note: ::slotted doesn't work for internal template, we can provide normal css with css selectors for default template Pros: (If there is no default template inside web component) 1. We can have default css for slot template which is coming from outside. 2. We can also override css for slot template which is coming from outside. Cons: (If there is a default template inside web component) 1. We can't override css for default template of slot which is written inside web component

  4. ::shadow, almost like ::part For Ex: In consumer CSS: usercard::shadow .user-card img { width: 10%; } Cons: Very less support of browsers, doesn't work mostly

  5. @apply CSS variables group For Ex: @apply --typography Cons: Very less support of browsers, doesn't work mostly

1.0.50

2 years ago

1.0.45

2 years ago

1.0.40

2 years ago

1.0.35

2 years ago

1.0.30

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago