description: How to use an SASS each loop to easily add multiple fonts to your CSS.
slug: include-css-fonts-using-sass-each-loop
tags:
- Compass
- Drupal Planet
- Fonts
- SASS
---
Using a file structure similar to this, organise your font files into directories, using the the font name for both the directory name and for the file names.
~~~~
.
├── FuturaBold
│ ├── FuturaBold.eot
│ ├── FuturaBold.svg
│ ├── FuturaBold.ttf
│ └── FuturaBold.woff
├── FuturaBoldItalic
│ ├── FuturaBoldItalic.eot
│ ├── FuturaBoldItalic.svg
│ ├── FuturaBoldItalic.ttf
│ └── FuturaBoldItalic.woff
├── FuturaBook
│ ├── FuturaBook.eot
│ ├── FuturaBook.svg
│ ├── FuturaBook.ttf
│ └── FuturaBook.woff
├── FuturaItalic
│ ├── FuturaItalic.eot
│ ├── FuturaItalic.svg
│ ├── FuturaItalic.ttf
│ └── FuturaItalic.woff
~~~~
Within your SASS file, start an `@each` loop, listing the names of the fonts. In the same way as PHP's `foreach` loop, each font name will get looped through using the `$family` variable and then compiled into CSS.
~~~~
@each $family in FuturaBook, FuturaBold, FuturaBoldItalic, FuturaItalic {