grunt-typograf
Version:
Prepare texts with Typograf using Grunt.
90 lines (73 loc) • 2.34 kB
Markdown
[grunt](http://gruntjs.com)-typograf
====================================
[](https://www.npmjs.com/package/grunt-typograf)
[](https://www.npmjs.com/package/grunt-typograf)
[](https://david-dm.org/typograf/grunt-typograf)
[](https://david-dm.org/typograf/grunt-typograf?type=dev)
[](https://travis-ci.org/typograf/grunt-typograf)
Prepare texts with [Typograf](https://github.com/typograf/typograf) for Grunt.
## Install
```bash
npm install typograf grunt-typograf --save-dev
```
## Usage
**Gruntfile.js**
```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
```js
module.exports = function (grunt) {
grunt.initConfig({
typograf: {
compile: {
options: {
locale: ['ru', 'en-US'],
htmlEntity: {
// Type of HTML entities:
// 'digit' -  ,
// '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](https://github.com/typograf/grunt-typograf/blob/master/LICENSE)
The MIT License.