Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unplugin-vue-ce/sub-style

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unplugin-vue-ce/sub-style

A vue plugin that extends vue's Custom Element capabilities (sub component style)

  • 1.0.0-beta.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
765
decreased by-46.47%
Maintainers
1
Weekly downloads
 
Created
Source

@unplugin-vue-ce/sub-style

The implementation principle of @unplugin-vue-ce/sub-style comes from vue/core pr #7942

Tips: ⚠ This plugin will inject the implementation code into the vue runtime, which is what I have to tell you. If you have any problems using it, please submit an issue

Snapshot

style.gif

Install

npm i @unplugin-vue-ce/sub-style

or

yarn add @unplugin-vue-ce/sub-style

or

pnpm add @unplugin-vue-ce/sub-style

Usage

Tips: You need to enable the customElement option of @vitejs/plugin-vue

Vite
// vite.config.ts
import { defineConfig } from 'vite'
import { viteVueCESubStyle } from '@unplugin-vue-ce/sub-style'
import vue from '@vitejs/plugin-vue'
import type { PluginOption } from 'vite'
export default defineConfig({
  plugins: [
    vue(),
    viteVueCESubStyle() as PluginOption,
  ],
})

Rollup
// rollup.config.js
import { rollupVueCESubStyle } from '@unplugin-vue-ce/sub-style'
export default {
  plugins: [
    rollupVueCESubStyle(),
  ],
}

Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('@unplugin-vue-ce/sub-style').webpackVueCESubStyle(),
  ],
}

Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('@unplugin-vue-ce/sub-style').webpackVueCESubStyle({}),
    ],
  },
}

ESBuild
// esbuild.config.js
import { build } from 'esbuild'
import { esbuildVueCESubStyle } from '@unplugin-vue-ce/sub-style'

build({
  plugins: [esbuildVueCESubStyle()],
})

About Tailwind CSS

Since vue enables shadow dom by default, it will isolate the style, so you need to add the root component of each web component to add the reference style:

<!-- xxx.vue -->
<style>
    @tailwind base;
    @tailwind components;
    @tailwind utilities;
</style>

or (only vite)

<!-- xxx.vue -->
<script>
  import '@virtual:taiwind'
</script>

About Uno CSS

Only postcss plugins are supported (See: https://unocss.dev/integrations/postcss#install),
you need to add the root component of each web component to add the reference style:

<!-- xxx.vue -->
<style>
    @unocss preflights;
    @unocss default;
    @unocss;
</style>

or (only vite)

<!-- xxx.vue -->
<script>
  import '@virtual:uno'
</script>

About Windi CSS

Windi css is not supported Windi CSS is Sunsetting

Keywords

FAQs

Package last updated on 23 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc