node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »

gulp-props

gulp-props

npm version Build Status Dependency Status

A Gulp plugin to convert Java .properties to JSON

Install

npm install --save-dev gulp-props

Usage

var props = require('gulp-props');
 
gulp.src('./src/*.properties')
  .pipe(props())
  .pipe(gulp.dest('./dist/'))
 
gulp.src('./src/*.properties')
  .pipe(props({ space: 2 }))
  .pipe(gulp.dest('./dist/'))
 
gulp.src('./src/*.properties')
  .pipe(props({ namespace: 'state' }))
  .pipe(gulp.dest('./dist/'))

API

props([options])

options.namespace

Type: String

Default: config

The namespace to use when defining properties. Javascript reserved words cannot be used here. Invalid identifiers will be adjusted to be valid, and a warning will be printed in the console.

options.space

Type: Number or String

Default: null

Control spacing in the resulting output. It has the same usage as for JSON.stringify

The option is used only when namespace option is an empty string.

options.replacer

Type: Function or Array

Default: null

Further transform the resulting output. It has the same usage as for JSON.stringify

The option is used only when namespace option is an empty string.

options.appendExt

Type: Boolean

Default: false

Append the extension (.js or .json) instead of replacing it.

Useful if the property files doens't have an extension.

License

MIT © Cristian Trifan