Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-typographic-adoption

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-typographic-adoption

A small, educational Grunt plugin that tackles typographic orphans in HTML block elements

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

grunt-typographic-adoption

A small, educational Grunt plugin that tackles typographic orphans in HTML block elements

I created this Grunt plugin to accompany my tutorial on SitePoint (yet to be published). It implements a simple task that replaces the last space in block elements with a non-breakable space to avoid typographic orphans.

Typographic orphans and widows

The image above appeared in the article 8 Simple Ways to Improve Typography In Your Designs by Antonio Carusone on Smashing Magazine.

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-typographic-adoption --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-typographic-adoption');

The "typographic_adoption" task

Overview

In your project's Gruntfile, add a section named typographic_adoption to the data object passed into grunt.initConfig().

grunt.initConfig({
  typographic_adoption: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Options

options.selectors

Type: Array Default value: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'blockquote', 'th', 'td', 'dt', 'dd', 'li']

An array of standard CSS selectors to control which elements get processed by the task.

Usage Examples

Default Options

This example would tackle typographic orphans in all block elements specified in the default value of options.selectors.

grunt.initConfig({
  typographic_adoption: {
    options: {},
    files: {
      'dest/default_options': [ 'src/sourcefile' ],
    },
  },
});
Custom Options

This example shows how you can overwrite the default value of options.selectors with any array of standard CSS selectors to steer which elements get processed by this task.

grunt.initConfig({
  typographic_adoption: {
    options: {
      selectors: ['p', '.quote', '#masthead-title']
    },
    files: {
      'dest/default_options': [ 'src/sourcefile' ],
    },
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 0.1.0

    First version

Keywords

FAQs

Package last updated on 05 Oct 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc