Home Download Buy Blog Forum Support

font-size & line-height plugin

font-size & line-height plugin

Postby parallax on Thu Jul 10, 2014 4:41 pm

Hi,

I thought some people (especially the CSS purists out there) may be interested in a plugin I just made:

https://github.com/andyfitch/fslh

It generates font-size and line-height em values based on px values. If you find yourself using Spotlight Search's maths functions or Calculator to figure out font-size and line-height em values.

Example
You want to use em units for fonts & your base font-size is 15px. You'd like a font-size of 20px, line-height of 24px.

.my-class {
15/20/24
}

Highlight 15/20/24 & press your keybinding (see fslh.sublime-keymap for an example, mine uses Cmd+Shift+L), and the result will be:

.my-class {
font-size: 1.3333333333em;
line-height: 1.2em;
}

Of course, in SASS you could use something like:

@function em($pixels) {
@return $pixels / $base-font-size + em;
}

But I thought I'd share anyway!

Cheers.
Parallax Agency
http://parall.ax/
parallax
 
Posts: 1
Joined: Thu Jul 10, 2014 4:37 pm
Location: Leeds & London

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 6 guests