gulp-resx-convert
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

gulp-resx-convert build package

A .resx file converter for gulp. Supports multiple output formats, including JSON, Typescript and C# constants class

Installation

Add this module as a development dependency:

npm install --save-dev gulp-resx-convert

Usage

This gulp plugin supports converting .resx files to multiple file types.

 
var resxConverter = require("gulp-resx-convert");
 
gulp.task("test", function () {
 
    gulp.src(["./Test/*.resx"]) //Pipe one or more files at a time
        .pipe(resxConverter.convert({
            //Include this for JSON
            json: {},
            //Include this for TypeScript
            typescript: {
                //Disables support for culture names in file name (ex: File.en-US.resx or File.en.resx).
                //Default: false
                culturesDisabled: false,
                //Sets the namespace to be used.
                //Default: Resx
                namespace:"Resx",
                //Enables converting to .ts files.
                //Default: false
                source: true,
                //Enables converting to .d.ts files
                //Default: false
                declaration: true
            },
            csharp: {
                //Sets the namespace to be used
                namespace: "Resx"
                //Output as properties or constants. Setting this to true will use properties
                properties: false;
                //Set this to true to create a partial class
                partial: false;
            }
        }))
        .pipe(gulp.dest("./Test/Output"));
});

Types from Resx

To specify the type to use in output instead of a string, use the Comment property in the .resx file to describe the type as in the followin example:

{"csharp":"int", "typescript":"number", "raw":true}

Setting the raw value to true means that the converter will output the value directly during assignment, without wrapping it in quotes. This should be used when the value is a number, boolean etc.

Notes

This plugin does not handle scenarios where file names contain spaces or invalid characters. Please use gulp-rename before converting the files.

Documentation

Additional documentation may be found in the Project Wiki

Package Sidebar

Install

npm i gulp-resx-convert

Weekly Downloads

157

Version

2.0.2

License

MIT

Unpacked Size

31.4 kB

Total Files

6

Last publish

Collaborators

  • winromulus