@amsterdam/asc-assets

中文文档
0.38.0发布于 2022/11/28MPL-2.0TypeScriptESM + CJS零依赖近 30 天下载 2357

Contains icons and fonts

此软件包已被标记为弃用

Amsterdam Styled Components is no longer supported. Use Amsterdam Design System (https://designsystem.amsterdam) instead.

原始使用文档
文档目录5 节
  1. Install
  2. Basic Usage
  3. Icons
  4. Fonts
  5. Build Project

asc-assets

This is a standalone package that contains:

  • Fonts (including CSS font-face definitions)
  • Icons (SVGs as React components)

Install

Add this package to your project by running:

npm install @amsterdam/asc-assets

Basic Usage

Icons

import { IconName } from '@amsterdam/asc-assets'

return <IconName />

Fonts

There are currently two ways of including the fonts used in your application, you can either copy them in from this package in your build or include a version from the Amsterdam CDN. Note that if you want to use the version hosted by Amsterdam you must have an application that runs in the amsterdam.nl domain space.

Using the Amsterdam CDN

Add the following code to your index.html file:

<link href="https://static.amsterdam.nl/fonts/fonts.css" rel="stylesheet" />

There is nothing more to do, the fonts should now be available in your application.

Copying the files at build time

This step assumes that you are using WebPack, but it should be possible to do this with other tools or a simple shell script as well.

Add the following code to your WebPack configuration:

new CopyWebpackPlugin({
  patterns: [
    {
      from: './node_modules/@amsterdam/asc-assets/static/fonts',
      to: 'fonts',
    },
  ],
})

And make sure to import the CSS file in your stylesheet:

@import '~@amsterdam/asc-assets/static/fonts/fonts.css';

Build Project

npm run build # generates JSX components using the optimized SVG icons

版本与发布记录

@amsterdam/asc-assets 共发布 37 个版本,首次发布于 2020/09/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.38.0latest2022/11/283 年前
0.37.02022/09/294 年前
0.36.02022/06/084 年前
0.35.42022/05/234 年前
1.0.0-alpha.0beta2022/05/204 年前
0.35.32022/05/204 年前

其他发布通道:canary → 0.33.1-alpha.45,beta → 1.0.0-alpha.0。

关于 @amsterdam/asc-assets 的常见问题

@amsterdam/asc-assets 是什么?

Contains icons and fonts注意:该包已被作者标记为弃用——Amsterdam Styled Components is no longer supported. Use Amsterdam Design System (https://designsystem.amsterdam) instead.

如何安装 @amsterdam/asc-assets?

在项目目录运行 npm install @amsterdam/asc-assets,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^17.0.2 || ^18.1.0)、react-dom(^17.0.2 || ^18.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@amsterdam/asc-assets 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@amsterdam/asc-assets 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@amsterdam/asc-assets 可以商用吗?

@amsterdam/asc-assets 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@amsterdam/asc-assets 的下载量有多少?

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

@amsterdam/asc-assets 还在维护吗?

最新版本 0.38.0 发布于 2022/11/28(3 年前);至今共发布 37 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/09/22。作者已将其标记为弃用,新项目建议寻找替代方案。