Comments (5)
Just so I understand correctly, there are about 40 components and all of them should have ShadowCSS?
For the Shadow Use Case I have created an example:
Component with limited style tag usage:
https://github.com/GrabarzUndPartner/nuxt-custom-elements/blob/feature/shadow-css/example/components/apps/AppShadow.vue
Two components with different import of ShadowCSS:
https://github.com/GrabarzUndPartner/nuxt-custom-elements/blob/feature/shadow-css/example/nuxt.config.js#L68
If you want to use the SingleFile Style tag, you would have to query it for a component. Unfortunately this seems to be not so easy, because the evaluation of the Vue-File is done in the vue-loader
and you don't get any css
back via the import
. Unless you write the style imports created by the vue-loader
itself.
Example: !raw-loader!vue-loader!@/components/apps/AppShadow?vue&type=style&index=0&lang=css
So you get the css
from the first style tag with lang css
. But what is missing here is the respective loader for compiling (e.g. PostCSS)
from nuxt-custom-elements.
Thanks for the answer, @ThornWalli. I tried your fork but from what I understood, it only takes care of including the styles of the imported Vue component, but all the styles that are being used hierarchically. Think of the following use-case:
main.vue:
<template>
<other-component />
</template>
<script>
import otherComponent './other-component'
export default {
components: {otherComponent}
}
</script>
other-component.vue:
<template>
<div class="elem">test</div>
</template>
<script>
export default {
}
</script>
<style>
.elem {
background:red
}
</style>
And here is the entries
of module config:
[
{
name: 'main',
tags: [
{
name: 'main',
path: '@/main.vue',
options: {
props: ['prop1', 'prop2'],
}
}
]
}
]
In this case, I expect the web-component to include the styles in other-component.vue
but it doesn't seem to include it. I can remove all the inline styles and convert it to <style lang="css" src="./stylesforothercomponent.css"></style>
but that doesn't help either.
from nuxt-custom-elements.
Am a little confused what you mean :)
Can you build me an example in a sandbox?
I have a report from an entry build here:
https://grabarzundpartner.github.io/nuxt-custom-elements/reports/webpack/nuxt-custom-elements/component-app-i18n/modern.html
There the GithubCorner is imported async, so the style is in the chunk.
If not imported async the style is in the entry.
from nuxt-custom-elements.
@ThornWalli Hello!
What about to add to the master those changes: import css from head to shadow css?
from nuxt-custom-elements.
@AlMuz Look at the version 1.8.0
, there the entry has now an option (shadow
) to make the contained tags to Shadow DOM
elements with styling.
from nuxt-custom-elements.
Related Issues (20)
- How to use nuxt-i18n HOT 2
- Action Required: Fix Renovate Configuration
- The automated release is failing 🚨
- options.props not considered for HTML tag if options is a function HOT 2
- Example of using a component from another origin HOT 3
- Generating components with baked-in async `data` HOT 2
- webpack chunk optimization HOT 2
- Switch to the official wc implementation HOT 2
- Not working with extractCSS HOT 1
- switching between multiple embedded components seems buggy HOT 23
- Dependency Dashboard
- [Progress] `nuxt@3` support HOT 58
- Generate only a single lang? HOT 4
- [Help] Fonts are not loaded correctly HOT 13
- [#ask] How to configure output css name HOT 4
- [Ask] Multiple entry points share same application HOT 1
- [Ask] How to change the webpack module default rules HOT 5
- nuxt3 - custom element entry with multiple tags only uses first tag HOT 1
- Strange behavior with multiple external applications HOT 9
- Cannot set properties of undefined (setting 'shadowMode') at setLoaderRulesForShadowMode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt-custom-elements.