grunt-surround

0.1.0 • Public • Published

grunt-surround

Surround the content of a file with another content.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-surround --save-dev

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-surround');

The "surround" task

Overview

In your project's Gruntfile, add a section named surround to the data object passed into grunt.initConfig().

grunt.initConfig({
  surround: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

Options

options.prepend

Type: String Default value: '' (empty String)

A string value that is prepended to the content.

options.append

Type: String Default value: '' (empty String)

A string value that is appended to the content.

options.overwrite

Type: Boolean Default value: false

Set this option to true to overwrite the source file instead of the destination file. Note: If you set this option to true, there is no need to specify a destination file.

options.linefeed

Type: String Default value: grunt.util.linefeed

The value for the linefeed.

options.ignoreRepetition

Type: Boolean Default value: false

Set this option to true to check if your content already starts or ends with the specified 'prepend' or 'append' option. If a match is found, your content will not be modified to avoid repetitions.

Usage Examples

grunt.initConfig({
  wraps: {
    options: {
      prepend: ';(function() {',
      append: '})()'
    },
    files: [{
      src: 'src/source.js',
      dest: 'dest/destination.js'
    }]
  }
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

Readme

Keywords

none

Package Sidebar

Install

npm i grunt-surround

Weekly Downloads

42

Version

0.1.0

License

none

Last publish

Collaborators

  • mario.bartlack