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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@liuweigl/sass-bem

v1.0.1

Published

使用 sass 编写 bem 风格的css

Downloads

4

Readme

sass-bem

使用 sass 编写 bem 风格的css。

声明

该方案是 element-ui 框架中的,本人只是根据实践经验对此进行了一些修改。

推荐

configs

自定义可参考 sass 变量声明语法。

| config | 含义 | 默认值 | | ------------------- | ---------------------- | ------ | | $namespace | class 前缀(命名空间) | app | | $block-separator | Block 分隔符 | - | | $element-separator | Element 分隔符 | -- | | $modifier-separator | Modifier 分隔符 | __ | | $state-prefix | 状态样式前缀 | is- |

mixins

| mixin | 含义 | | ------------- | ------------------- | | b | BEM 中的 Block | | e | BEM 中的 Element | | m | BEM 中的 Modifier | | spec-selector | 用于自定义嵌套样式 | | when | 定义一个状态样式 |

使用

手动引入

  1. 安装:npm install sass-bem -D
  2. 使用
/* demo.scss */

@import 'sass-bem/index.scss';

@include b(demo){
  /* rules */
  @include e(tip){
      /* rules */
  }
  ...
}

webpack

在任何一个 sass 文件中都可使用 bem.scss 中的 mixin

  1. 安装:npm install sass-bem -D
  2. 安装: npm install sass-resources-loader -D
  3. 配置 sass-resources-loader:

module.exports = {
  // ....
  module: {
    rules: [
      // ....
      {
        test: /\.scss$/,
        use: [
          {
            loader: 'sass-resources-loader',
            options: {
              sourceMap: true,
              resources: [
                '~sass-bem/index.scss'
              ]
            }
          }
        ]
      }
    ],
  }
};

vue 项目: vue-demo

angular 项目 angular-demo