Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
gel-typography
Advanced tools
A flexible code implementation of the GEL Typography.
Forms part of the GEL Foundations
An implementation of the GEL Typography Guidelines. Providing typefaces, type sizes, weights, line-heights and tracking. The GEL Typography scale has been established to work on all devices and is independent of device size and resolution.
The typographic scale has been optimised based on the size of the viewport and the input method being used. We take a 'touch first' approach to typography, adjustments are then made if a primary input other than touch has been detected.
It can used in two forms, using a Sass mixin:
.my-component {
@include gel-typography('canon-bold');
}
Or by simply adding the relevant classes to your markup:
<h1 class="gel-canon-bold">Global Experience Language</h1>
The easiest way to get started with the GEL Typography component is to use the combined version of the typography included within this repository.
If you're a more advanced user and want to integrate the GEL Typography component within your codebase, use one of the following options:
$ bower install --save gel-typography
// your-app/main.scss
@import 'bower_components/gel-sass-tools/sass-tools';
@import 'bower_components/sass-mq/mq';
@import 'bower_components/gel-typography/typography';
$ npm install --save gel-typography
// your-app/main.scss
@import 'node_modules/gel-sass-tools/sass-tools';
@import 'node_modules/sass-mq/mq';
@import 'node_modules/gel-typography/typography';
You can install this component manually by downloading the content of this Git repo into your project and use a Sass @import to include it in your project.
Note: you will manually need to manage the dependencies below, without these this component will fail to compile.
In order to use the component you will need the following components available:
By default the GEL Typography component does not output any markup but exposes a Sass Mixin which can be called within your Sass.
Example
.my-component {
@include gel-typography('pica');
}
.my-component__title {
@include gel-typography('canon');
}
A collection of typography classes can be output by defining $gel-type-enable--markup-output: true;
before you @import
the typography partial.
Example:
$gel-type-enable--markup-output: true;
@import "gel-typography/typography";
The following configurable options are available:
$gel-type-namespace: 'gel-';
- the default namespace applied to all typography classes$gel-type-touch-class: 'no-touch';
- the class exposed used by your touch detection script applied when a non-touch interface is detected$gel-type-enable--markup-output: false;
- output a collection of classes for each type group$gel-type-enable--font-family: false;
- output the correct font-family required by GEL Typography, required if the BBC's global header and footer, Barlesque, is not available.$gel-type-enable--base-elements: false;
- map the GEL Typography classes to the relevant HTML elementsIf you're using another font-face other than Arial and need to make adjustments to any of the type settings you can do this by defining in a custom $gel-type-settings
map.
For example: BBC News support many languages, some of which do not use latin based character sets which require custom font scripts. It is often the case that these custom fonts will require bespoke font-sizes or line-heights.
For example, the configuration for Burmese may look like:
$gel-type-settings: (
'trafalgar': (
'group-a': (
'font-size': 22px,
'line-height': 30px,
),
'group-b': (
'font-size': 26px,
'line-height': 36px
),
'group-c': (
'font-size': 38px,
'line-height': 50px
),
'group-d': (
'font-size': 32px,
'line-height': 32px
)
),
'trafalgar-bold': (
...
)
);
We operate a touch-first approach to our Typography. Group C (touch) sizes are used from 600px by default and then detection should be used to get the Group D (non-touch) sizes.
We also understand that touch detection is not an absolute measure and does not guarantee a 'true or false' outcome - this is okay.
Products such as News & Sport require more densely packed, legacy-like font sizes for their 'desktop' experience. Eventually we aim to remove this group altogether.
There are a number of ways you can apply the touch detection. Modernizr, the common feature detection library offers some basic touch events detection. Alternatively, you could use your own bespoke detection script like this one used by BBC Sport.
The following teams are currently using this component: GEL, News, Sport, Live, Homepage, Search, BBC Food, CBBC, CBeebies, BBC Three, MyBBC, K&L, Taster, Academy, Travel & Weather, BBC Music
If your team is using this component, let us know and we'll add you to the list.
The MIT License (MIT)
Copyright 2016 British Broadcasting Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A flexible code implementation of the GEL Typography
We found that gel-typography demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.