Sass config and templates utility

Mixins, functions and variables to power all vf-core components. If you're using a Visual Framework component it's a near-certainty that you'll need this component.

github location npm version

Usage

Note: these utilise vf-design-tokens

Functions

set-color.scss

set-color($color-name)

map-deep-get.scss

map-deep-get($map, $keys)

set-layer.scss

set-layer($layer)

string-replace.scss

str-replace($name, $number)

Slice off the first amount($number) of characters from the $name value passed. Primarily used to replace the start of variables for the utility class generation.

vf-functions.scss

Rollup of all functions.


Mixins

blockquote.scss

Reusable styling for html blockquote elements.

@include blockquote;

button.scss

Reusable styling for button elements

@include vf-button;

divider.scss

Reusable styling for divider elements and styling

@include vf-divider;

figure.scss

Reusable styling for figures with optional caption styling

@include figure($has-caption: true);

helpers.scss

Nothing, yet.

links.scss

Styling for links.

@include inline-link( $vf-link--color: $vf-link--color, $vf-link--hover-color: $vf-link--hover-color, $vf-link--visited-color: $vf-link--visited-color, $vf-include-normalisations: $vf-include-normalisations);

@include button-link( $vf-link--color: $vf-link--color, $vf-link--hover-color: $vf-link--hover-color, $vf-link--visited-color: $vf-link--visited-color);

button-link--ghost( $vf-link--color: $vf-link--color, $vf-link--hover-color: $vf-link--hover-color, $vf-link--visited-color: $vf-link--visited-color);

lists.scss

Styling for list types

@include($classname: optional-classname-to-usm, $type: null, unordered, ordered or inline);

margin.scss

Margin, recommended to use with sizing maps

@include margin--block(bottom, map-get($vf-spacing-map, vf-spacing--500));

  • margin-block: specify one value for bottom and top, top or bottom
  • margin-all: specify one value for left or right, left or right
  • margin: specify all or a value for each

padding.scss

Padding, recommended to use with sizing maps

@include padding--block(bottom, map-get($vf-spacing-map, vf-spacing--500));

  • padding-block: specify one value for bottom and top, top or bottom
  • padding-all: specify one value for left or right, left or right
  • padding: specify all or a value for each

text-color.scss

Currently not used. Intelligently pick if white or black should be used as a contrasting colour

typography.scss

Generate correct font information when included into an element. Recommended to use with typography and sizing maps

@include set-type(text-body--3, $global-font-family, $custom-margin-bottom: vf-spacing--500, $color: secondary)

Color setting can be turned off by passing $color: ignore.

utility--color.scss

Generate lists of values in design token maps. Intended for use by the vf-utility-classes component

utility--slide.scss

A non-jitter causing way to slide elements up/down on hover.

@include vf-slide-on-hover($shift-distance, $direction:up);

utility--spacing.scss

Generate lists of values in design token maps. Intended for use by the vf-utility-classes component

utility--typography.scss

Generate lists of values in design token maps. Intended for use by the vf-utility-classes component

vf-mixins.scss

Rollup of all mixins.

vf-utility-mixins.scss

Rollup of all utility mixins.

vf-disabled.scss

For disable link elements, actions @include vf-disabled($vf-link--disabled-color);


Variables

vf-global-custom-properties.scss

Native CSS properties, currently limited to document spacing.

vf-global-variables.scss

Global Sass variable defaults for the high-level page look of typography, page width, deprecated component text, if normalisations should be included.

vf-variables.scss

Rollup of global Sass variables.

Variants

HTML
<!-- no template -->
              

Examples

Installation info

This repository is distributed with npm. After installing npm, you can install vf-sass-config and its dependencies with this command.

$ yarn add --dev @visual-framework/vf-sass-config @visual-framework/vf-design-tokens

You might also find the the vf-sass-starter a useful starting point for setting up a customised Sass build.

Sass/CSS

The style files included are written in Sass. If you're using a VF-core project, you can import it like this:

@import 'vf-global-variables';
@import 'vf-variables';
@import 'vf-functions';
@import 'vf-mixins';

Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter

Changelog

Changelog

2.7.3

  • Dependency bump

2.7.2

  • Small variant added, documentation updated, responsive support added for vf-blockquote Tracking issue

2.7.2

  • Changes to use primary colours instead of secondary colours for text-body.Tracking issue

2.7.1

  • Make vf-divider respect vf-stack spacing.
  • https://github.com/visual-framework/vf-core/pull/1723

2.7.0

  • @mixin set-type margin-top now inherits any applicable vf-stack margin.
  • https://github.com/visual-framework/vf-core/pull/1698

2.6.2

  • Add map to interactive-color sass map
  • https://github.com/visual-framework/vf-core/issues/1688

2.6.1

  • Improve reliability of mixin for link-color and brand-color when using the default color.
  • Mixin for inline-link now uses link-color mixin.
  • Mixin for set-type now sets a colour depending on font sizes (opt-out by passing $color: ignore).
  • https://github.com/visual-framework/vf-core/pull/1606

2.6.0

  • Changes mixin set-type to use the primary colour (off black) by default
  • Adds functions and imports for:
  • vf-color__text.custom-properties.scss
  • vf-color__buttons.custom-properties.scss
  • vf-color__brand.custom-properties.scss
  • Prepare to deprecate vf-themes.custom-properties.scss

2.5.4

  • Darken and increase figure text size
  • https://github.com/visual-framework/vf-core/issues/1582

2.5.3

  • Adds mixins/vf-utility-mixins.scss to index.scss
  • Fixes a broken variable reference.
  • https://github.com/visual-framework/vf-core/issues/1469

2.5.2

  • Fix key name in vf-color--neutral lookup.
  • https://github.com/visual-framework/vf-core/pull/1460

2.5.1

  • adds neutral colours in the custom variables import file

2.5.0

  • adds neutral colour tokens function neutral(Nn)

2.4.1

  • changes any set- style functions to cleaner version
  • fixes issue now link color disabled no longer exists

2.4.0

  • updates the $global-page-max-width variable so that it's consistent with the page width across components - set to 80rem

2.3.1

  • fixes bug in --page-grid-gap printing Sass function in CSS

2.3.0

  • introduces a space Sass function to save the keystrokes.
  • instead of typeing map-get($vf-spacing-map, vf-spacing--400) you can write spacing(400) for the same result.
  • I've added this terse naming of the function for set-color and set-ui-color to be something like color(green) instead of set-color(vf-color--green). The old way still works.
  • fixes import order of vf-global-custom-properties.scss
  • https://github.com/visual-framework/vf-core/pull/1263

2.2.1

  • fixes bug where --page-grid-gap wasn't getting it's correct spacing unit because the Sass map-get was not interpolated.

2.2.0

  • updates --page-grid-gap for larger viewports to 2rem instead of 1.5rem.
  • updates the embl-grid small column size from 238px to 16rem.

2.1.0

  • replaces spacing design tokens

2.0.0

  • removes the inline margin from the component
  • adds the block end margin an creates a Sass variable for $margin--block-end
  • adds width: 100%; as it was defaulting to width: auto;

1.4.3

  • adds webkit-appearance: none; as needed for Safari browsers as autoprefixer is not doing this

1.4.2

  • updates the $global-page-max-width variable so that it's consistent with the page width across components - set to 81.25rem

1.4.0

  • creates supporting Sass files for new theming design tokens to be used

1.3.0

  • adds a width css custom property for vf-body component
  • reorganises the order variables are used

1.2.0

  • creates mixin for grid column and row gap
  • Restores the ability to have local design tokens by not requiring a npm-installed vf-design-tokens
  • https://github.com/visual-framework/vf-core/pull/1009

1.1.2

  • Changes filepaths so they're relative where needed

1.1.1

  • Adds missing global custom properties

1.1.0

  • Adds the relative paths to @import for files rather for when the index.scss is used in other projects
  • Adds stylelint dis/enabled wrapper so it doesn't shout about design tokens
  • Adds @visual-framework/vf-design-tokens as a dependency

1.0.3

  • Breakpoint map was missing from vf-variables.scss

1.0.1

  • Tweaks link mixin, adds @mixin inline-link--dark-mode

1.0.0

  • Initial stable release

Assets



File system location: components/vf-sass-config

Find an issue on this page? Propose a change or discuss it.