Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
grunt-typographic-adoption
Advanced tools
A small, educational Grunt plugin that tackles typographic orphans in HTML block elements
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.
The image above appeared in the article 8 Simple Ways to Improve Typography In Your Designs by Antonio Carusone on Smashing Magazine.
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');
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.
},
},
});
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.
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' ],
},
},
});
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' ],
},
},
});
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.
0.1.0
First version
FAQs
A small, educational Grunt plugin that tackles typographic orphans in HTML block elements
We found that grunt-typographic-adoption demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.