1.0.89 • Published 3 years ago

petalmd-font v1.0.89

Weekly downloads
440
License
Apache-2.0
Repository
-
Last release
3 years ago

petalmd.font

This is a scss-powered icon font for our beloved PetalMD application, it has been designed to reduce the pain of rendering vector-based icons by using simple html classes, scss functions and mixins.

Installation

npm install petalmd.font

scss

  1. Import the font styles into your scss tree:
@import 'petalmd.font';
  1. Include the font-face in your application stylesheet:
@font-face {
  font-family: '#{$pf-font-name}';
  src: url('#{$pf-font-path}/#{$pf-font-name}.eot');
  src: url('#{$pf-font-path}/#{$pf-font-name}.eot?#iefix') format('embedded-opentype'),
    url('#{$pf-font-path}/#{$pf-font-name}.woff2') format('woff2'),
    url('#{$pf-font-path}/#{$pf-font-name}.woff') format('woff'),
    url('#{$pf-font-path}/#{$pf-font-name}.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

By default the scss file is providing the entire toolkit, If you want a granular control on the imports, no problem, you can still include them on a per-feature basis:

@import 'petalmd.font/core';
@import 'petalmd.font/mixins';
@import 'petalmd.font/larger';
@import 'petalmd.font/stacked';
@import 'petalmd.font/flipped';
@import 'petalmd.font/rotated';

Note: if you're using libsass you may want to include the font scss using the includePaths option:

includePaths: ['node_modules/petalmd.font/scss/']

.eot, .ttf, .woff and .woff2 fonts

The font files are availables into the node_modules/petalmd.font/fonts/ directory, you just need to refer them into your favorite asset pipeline.

Configuration

Please look at scss/petalmd.font/_settings.scss file.

Usage

Mixins & functions

The same goal can be achieved by using the icon-element mixin:

a.download + i {
  @include icon-element;

  &:before {
    content: icon('download');
  }
}

Hacking on the font

I want to add a new icon to the font

Adding a file to the icons folder will do the job, the icon file must be a .svg file. Please note that your file name will be used as a reference for the generated class name.

If you're using Adobe Illustrator, please save your file as SVG with the following settings:

  • SVG Profiles: SVG 1.1
  • Fonts Type: SVG
  • Fonts Subsetting: None
  • Options Image Location: Embed
  • Advanced Options
    • CSS Properties: Presentation Attributes
    • Decimal Places: 2
    • Encoding: UTF-8
    • Output fewer elements: check

Leave the rest unchecked.

I want to build the font on my computer

First, clone this repository then install dependencies:

npm install

You must also install ttfautohint@1.5:

brew install ttfautohint

Then download version 1.5 from here. Place the 1.5 folder in your ttfautohint folder and run :

brew switch ttfautohint 1.5

This project is extensively using gulp for generating the font, let's install & run it:

npm install -g gulp
gulp

I want to add a new icon to Petalweb

  • First of all, you have to read the previous paragraph and install gulp before going further
  • Then, go in petalmd.font/icons folder and copy/paste your new icons
  • Add your new icons in /scss/petalmd-font/_glyphs.scss
  • Upgrade the version of the package.json file (example: 1.0.6 -> 1.0.7)
  • Run the svgo task to optimize your new icons
gulp svgo
  • Run the font task
gulp font
  • Commit and push your new files
  • Run npm login
npm login

(Visit the Petal documentation repo to find identification information)

  • Run npm publish
npm publish
  • Last thing, open the petalmd web app and update the petalmd-font version in package.json with the new one. (example: 1.0.7)

That's it, have fun!

License

Apache 2 license for code and assets, please see LICENSE file.

1.0.89

3 years ago

1.0.88

3 years ago

1.0.87

3 years ago

1.0.86

3 years ago

1.0.85

3 years ago

1.0.84

5 years ago

1.0.83

5 years ago

1.0.82

5 years ago

1.0.81

6 years ago

1.0.80

6 years ago

1.0.79

6 years ago

1.0.78

6 years ago

1.0.77

6 years ago

1.0.76

6 years ago

1.0.75

6 years ago

1.0.74

6 years ago

1.0.73

6 years ago

1.0.72

6 years ago

1.0.71

6 years ago

1.0.70

6 years ago

1.0.69

6 years ago

1.0.68

6 years ago

1.0.67

6 years ago

1.0.66

6 years ago

1.0.65

6 years ago

1.0.64

6 years ago

1.0.63

6 years ago

1.0.62

7 years ago

1.0.61

7 years ago

1.0.60

7 years ago

1.0.59

7 years ago

1.0.58

7 years ago

1.0.57

7 years ago

1.0.56

7 years ago

1.0.55

7 years ago

1.0.54

7 years ago

1.0.53

7 years ago

1.0.52

7 years ago

1.0.51

7 years ago

1.0.50

7 years ago

1.0.49

7 years ago

1.0.48

7 years ago

1.0.47

7 years ago

1.0.46

7 years ago

1.0.45

7 years ago

1.0.44

7 years ago

1.0.43

7 years ago

1.0.42

8 years ago

1.0.41

8 years ago

1.0.40

8 years ago

1.0.39

8 years ago

1.0.38

8 years ago

1.0.37

8 years ago

1.0.36

8 years ago

1.0.35

8 years ago

1.0.34

8 years ago

1.0.33

8 years ago

1.0.32

8 years ago

1.0.31

8 years ago

1.0.30

8 years ago

1.0.29

8 years ago

1.0.28

8 years ago

1.0.27

8 years ago

1.0.26

8 years ago

1.0.25

8 years ago

1.0.24

8 years ago

1.0.23

8 years ago

1.0.22

8 years ago

1.0.21

8 years ago

1.0.20

8 years ago

1.0.19

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago