首页 > 解决方案 > 获取scss文件中className的内容

问题描述

我有 scss 文件,我想解析它并获取我选择(动态)的类的内容,如果应该返回指定类的所有内容。

.styles-module--ctaArrow--JtKM2 {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-top: 55px;
  width: 48px;
  height: 38px;
  transition: width .25s ease-in-out
}

@media (max-width: calc(992px - 1px)) {
  .styles-module--ctaArrow--JtKM2 {
    margin-top: 22px
  }
}

.styles-module--ctaArrowLine--2Lcej {
  display: inline-block;
  width: calc(100% - 4px);
  height: 4px;
  background: #0058ff
}

.styles-module--ctaArrowIcon--1AFVc {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  transition: right .25s ease-in-out
}

我想获取课程的styles-module--ctaArrowLine--2Lcej内容

  display: inline-block;
  width: calc(100% - 4px);
  height: 4px;
  background: #0058ff

如果有任何 NPM 包会很棒。

标签: javascriptsass

解决方案


推荐阅读