@dsco_/common

中文文档
1.1.0发布于 2022/02/10MITCommonJS零依赖近 30 天下载 2299

Common styles and utilities for DSCO consumers

原始使用文档
文档目录5 节
  1. mixins
  2. styles
  3. SCSS
  4. JavaScript
  5. tokens

@dsco_/common

This package contains all DSCO design constants, tokens, and styles. These are made available as SCSS files.

Notes:

  • The @use Sass feature is only available for Dart Sass. If you are using a different Sass implementation, replace @use with @import. Internally, this package uses @import to maintain compatibility with all Sass implementations.
  • The import paths below use the "exports" field in package.json, which is a feature only available to Webpack 5+ consumers. If you use Webpack 4 or below, you should import this package as @dsco_/common (which corresponds to the "main" field in package.json), or point to a specific file in the package (e.g., @dsco_/common/styles/_tokens.scss).

mixins

Common mixins.

Let's say this export defines a font-regular mixin. Example usage:

@use '@dsco_/common/mixins';

.text {
  @include mixins.font-regular;
}

styles

Common utility classes. All classes should be prefaced with dsco- for namespacing and consistency.

Let's say this export defines a dsco-text class. Example usages:

SCSS

// text.module.scss
@use '@dsco_/common/styles';

.text {
  @extend .dsco-text;
  // additional styles
}

JavaScript

// Text.jsx
import '@dsco_/common/styles';

export default function Text({text}) {
  return <p className="dsco-text">{text}</p>;
}

tokens

A set of SCSS variables that serve as design tokens for DSCO. These constants should be prefaced with dsco- for namespacing and consistency.

Example usage:

// @dsco_/common/tokens
$dsco-text-color: purple;
// text.module.scss
@use '@dsco_/common/tokens';

.text {
  color: tokens.$dsco-text-color;
}

版本与发布记录

@dsco_/common 共发布 5 个版本,首次发布于 2022/02/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2022/02/104 年前
1.0.02022/02/104 年前
0.1.02022/02/084 年前
0.0.22022/02/024 年前
0.0.12022/02/024 年前

关于 @dsco_/common 的常见问题

@dsco_/common 是什么?

Common styles and utilities for DSCO consumers

如何安装 @dsco_/common?

在项目目录运行 npm install @dsco_/common,或使用 pnpm add / yarn add / bun add。

@dsco_/common 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dsco___common 是否存在。

@dsco_/common 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@dsco_/common 可以商用吗?

@dsco_/common 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@dsco_/common 的下载量有多少?

根据 npm 官方下载统计,@dsco_/common 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,299 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dsco_/common 还在维护吗?

最新版本 1.1.0 发布于 2022/02/10(4 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/02/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。