grunt-file-wrap

0.0.2 • Public • Published

grunt-file-wrap

Uses text-wrap to add a header + footer into your text files.

Build Status

Installing

$ npm install grunt-file-wrap --save-dev

Example

module.exports = function (grunt) {
    grunt.initConfig({
        fileWrap: {
            regular: {
                header: 'header text', // if fileMode = true, it is a file name
                footer: 'footer text', // if fileMode = true, it is a file name
                files: {
                    // matching input and output will rewrite the source file;
                    "output1.txt": "input1.txt",
                    "output2.txt": "input2.txt"
                },
                options: {
                    // fileMode, skipCheck, unique
                }
            },
            withCwd: {
                header: 'header text', // if fileMode = true, it is a file name
                footer: 'footer text', // if fileMode = true, it is a file name
                src: ["files/*.txt"],
                dest: "out/",
                cwd: "./", // current working directory
                options: {
                    // fileMode, skipCheck, unique
                }
            },
            withRewrite: {
                // in order to rewrite the source files, skip property 'dest': 
                header: 'header text', // if fileMode = true, it is a file name
                footer: 'footer text', // if fileMode = true, it is a file name
                src: ["files/*.txt"],
                options: {
                    // fileMode, skipCheck, unique
                }
            }
        }
    });
    
    grunt.loadNpmTasks('grunt-file-wrap');
    grunt.registerTask('default', ['fileWrap']);
};

Options

fileMode ⇒ Boolean

  • false (default) - contents of header and footer is a plain text
  • true - header and footer are file names from where to load the content

skipCheck, unique

Boolean options supported by text-wrap:

License

Copyright © 2016 Vitaly Tomilov; Released under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i grunt-file-wrap

Weekly Downloads

101

Version

0.0.2

License

MIT

Last publish

Collaborators

  • vitaly.tomilov