grunt-typograf
v6.0.0
Published
Prepare texts with Typograf using Grunt.
Downloads
22
Maintainers
Readme
grunt-typograf
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' -  ,
// '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.