grunt-typograf

6.0.0 • Public • Published

grunt-typograf

NPM version NPM downloads Dependency Status devDependency Status Build Status

Prepare texts with Typograf for Grunt.

Install

npm install typograf grunt-typograf --save-dev

Usage

Gruntfile.js

module.exports = function (grunt) {
  grunt.initConfig({
    typograf: {
      compile: {
        options: {
          locale: ['ru', 'en-US']
        },
        files: {
          'hello.txt': ['header.txt', 'footer.txt']
        }
      }
    }
  });
 
  grunt.loadNpmTasks('grunt-typograf');
  grunt.registerTask('default', ['typograf']);
};

With additional options

module.exports = function (grunt) {
  grunt.initConfig({
    typograf: {
      compile: {
        options: {
          locale: ['ru', 'en-US'],
          htmlEntity: {
            // Type of HTML entities:
            // 'digit' - &#160,
            // 'name' -  ,
            // 'default' - UTF-8
            type: 'digit'
          },
 
          disableRule: ['ru/optalign/*'],
          enableRule:  ['ru/money/ruble'],
 
          // Own rules
          rules: [
            {
              name: 'common/other/typographicalEmoticon',
              handler: (text, settings) => text.replace(/:-\)/, ':—)')
            },
            {
              name: 'common/other/trimLeft',
              handler: (text, settings) => text.trimLeft()
            }
          ]
        },
 
        files: {
          'hello.txt': ['header.txt', 'footer.txt']
        }
      }
    }
  });
 
  grunt.loadNpmTasks('grunt-typograf');
  grunt.registerTask('default', ['typograf']);
};

License

The MIT License.

Package Sidebar

Install

npm i grunt-typograf

Weekly Downloads

3

Version

6.0.0

License

MIT

Last publish

Collaborators

  • kobezzza