@bbc/gel-foundations

中文文档
7.0.0发布于 2021/09/30Apache-2.0零依赖近 30 天下载 3.1万

A range of string constants for use in CSS, intended to help implement BBC GEL-compliant webpages and components.

原始使用文档
文档目录7 节
  1. Exports
  2. Installation
  3. Usage
  4. Script support
  5. Contributing
  6. Code of Conduct
  7. License

gel-foundations - Known Vulnerabilities Dependency Status peerDependencies Status GitHub license npm version PRs Welcome

This package provides a range of string constants for use in CSS, intended to help implement BBC GEL-compliant webpages and components.

Exports

/breakpoints - GEL breakpoints, as well as typography breakpoints. These use the GEL grid sizes which can be found in the GEL Grid guidelines. /spacings - GEL spacings and GEL Grid margins and gutters. These use the GEL grid spacing sizes which can be found in the GEL Grid guidelines. /typography - GEL type sizes and font stacks. These are based on the GEL Typography definitions which can be found in the GEL guidelines. More details on how the type sizes were implemented for this package are available here.

Installation

npm install @bbc/gel-foundations --save

Usage

import { GEL_GROUP_3_SCREEN_WIDTH_MIN } from '@bbc/gel-foundations/breakpoints';

import { GEL_GUTTER_ABOVE_600PX } from '@bbc/gel-foundations/spacings';

import { getLongPrimer } from '@bbc/gel-foundations/typography';

These values can then be used directly within CSS declarations in code:

import { css } from 'styled-components';

const SomeStyledComponent = css`
  font-family: ${GEL_FF_REITH_SANS};
  ${getLongPrimer(script)};

  @media (min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) {
    grid-gap: ${GEL_GUTTER_ABOVE_600PX};
  }
`;

To allow the typography to be fully accessible and responsive, please note that you should apply a default font-size to the document root (e.g. html { font-size: 100% }).

Our typography uses rem for font-size and line-height. The rem unit represents a size relative to the document root, so we use that for font-size, line-height and spacing for a consistent look-and-feel across the document. You can read our detailed analysis of "REMs vs EMs for spacing" for more information.

Script support

The utility typography function (e.g. getLongPrimer('arabic')) receives a script argument which is an object with the different script GEL Types Sizes and returns the font-sizes and line-heights for the specific GEL Type (e.g. Long Premier).

You can import the script doing import { arabic } from '@bbc/gel-foundations/scripts. By default you should import the latin script as found on the GEL typography guidelines.

In addition to Latin script defaults, Psammead supports typography for a number of other scripts. We have grouped the scripts that share similiar features as follows:

Group NameServicesRationale
latin-and-cyrillicNews, Hausa, Gahuza, Somali, Swahili, Igbo, Pidgin, Afaan Oromo, Yoruba, Azeri, Indonesia, Uzbek, Serbian, Russian, Ukrainian, Kyrgyz, UzbekThe typography values for Latin and Cyrillic characters are identical
latin-with-diacriticsVietnamese, Mundo, Afrique, Brasil, TurkishThe diacritics make these values differ from Latin
arabicArabic, Pashto, Persian, UrduGroup as they use the Arabic alphabet
no-ascenders-or-descendersKorean, Japanese, Zhongwen, Ukchina, Tigrinya, AmharicGroup all alphabets without ascenders or descenders. This could be implemented as chinese, korean, ethiopic
devanagari-and-gurmukhiHindi, Nepali, Gujarati, Punjabi, Marathi, TeluguThe typography values for Devanagari and Gurmukhi characters are identical
thaiThaiBespoke to the Thai characters
bengaliBengaliBespoke to the Bengal characters
burmeseBurmeseBespoke to the Burmese characters
sinhaleseSinhalaBespoke to the Sinhalese characters
tamilTamilBespoke to the Tamil characters

Contributing

When adding a new export to this utility package the export tests also need to be updated. When removing an exisiting export from this utility package the export tests need to be updated and the package version requires a major change (EG: 1.2.1 -> 2.0.0) as this would be considered a breaking change as functionality is being removed.

Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead respository.

Code of Conduct

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Psammead is Apache 2.0 licensed.

版本与发布记录

@bbc/gel-foundations 共发布 45 个版本,首次发布于 2018/12/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.0.0latest2021/09/305 年前
6.3.02021/09/175 年前
6.2.02021/09/165 年前
6.1.32021/03/025 年前
6.1.22021/02/225 年前
6.1.12021/02/045 年前

关于 @bbc/gel-foundations 的常见问题

@bbc/gel-foundations 是什么?

A range of string constants for use in CSS, intended to help implement BBC GEL-compliant webpages and components.

如何安装 @bbc/gel-foundations?

在项目目录运行 npm install @bbc/gel-foundations,或使用 pnpm add / yarn add / bun add。

@bbc/gel-foundations 支持 TypeScript 吗?

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

@bbc/gel-foundations 可以商用吗?

@bbc/gel-foundations 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bbc/gel-foundations 的下载量有多少?

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

@bbc/gel-foundations 还在维护吗?

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