npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

taro-scoped-styles

v1.1.0

Published

Taro 插件:让 Vue SFC scoped 样式在所有小程序平台生效

Readme

简介

为了解决Taro也能够在小程序使用scoped。

Vue SFC 的 <style scoped> 通过 data-v-xxx 属性选择器实现样式隔离,但小程序平台对属性选择器支持不一致,且 Taro 编译过程中可能丢失这些属性,导致 scoped 样式失效。

本插件将 data-v-xxx 属性选择器转换为类名选择器,让 scoped 样式在所有小程序平台正常工作。

特性

  • ✅ 纯编译时转换,零运行时开销
  • ✅ 兼容所有 Taro 支持的小程序平台
  • ✅ 支持 Vue 3 和 Vue 2
  • ✅ 支持 CSS / SCSS / Less / Stylus
  • ✅ 支持 :deep() / ::v-deep / >>> 深度选择器
  • ✅ 不影响非 scoped 样式
  • ✅ 只会在小程序端使用,不会影响RN、H5等非小程序

快速开始

安装依赖

npm install taro-scoped-styles --save-dev
# 或
yarn add taro-scoped-styles -D
# 或
pnpm add taro-scoped-styles -D

Taro config文件配置(插件会在编译时自动处理,无需其他配置。)

const config = {
  plugins: ['taro-scoped-styles']
}

兼容性

  • 完美支持 Taro 3.x 和 Taro 4.x
  • ✅ Vue 3(推荐)/ Vue 2
  • ✅ 所有 Taro 支持的小程序平台

平台识别机制

插件会自动检测编译平台,并仅在以下小程序平台启用:

  • 微信小程序 (weapp)
  • 支付宝小程序 (alipay)
  • 字节跳动小程序 (tt)
  • 百度小程序 (swan)
  • QQ 小程序 (qq)
  • 京东小程序 (jd)

H5 / React Native / Harmony 等平台原生支持 scoped,插件会自动跳过处理。

Taro 版本兼容

插件内部实现了智能平台识别机制:

// Taro 3.x: ctx.runOpts.platform
// Taro 4.x: ctx.runOpts.options.platform
const platform = ctx.runOpts?.options?.platform || ctx.runOpts?.platform || process.env.TARO_ENV;

无论你使用 Taro 3.x 还是 Taro 4.x,插件都能正确识别编译平台。

许可证

MIT