6.0.0 • Published 7 years ago

grunt-typograf v6.0.0

Weekly downloads
125
License
MIT
Repository
github
Last release
7 years ago

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.

6.0.0

7 years ago

5.1.0

7 years ago

5.0.4

8 years ago

5.0.3

8 years ago

5.0.2

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.0.1

8 years ago

4.0.0

9 years ago

3.0.1

9 years ago

3.0.0

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