gulp-mu-csharp-concat-postwork
v2.0.0
Published
Post-processing for concatenated C# files: hoists using-directives to the top and (for release builds) strips comments, blank lines and logging calls.
Maintainers
Readme
gulp-mu-csharp-concat-postwork
Post-processing step for concatenated C# (
.cs) files.
After concatenating several C# source files into one (e.g. with gulp-concat),
this plugin cleans up the result:
- Collects all
using ...;directives, de-duplicates them and hoists them to the top of the file (C# requiresusingdirectives before any other declarations). - For release builds it additionally removes blank lines, line comments (
//...) and logging calls (Logging.log(...),Debug.Log(...)), and trims each line.
Install
npm install --save-dev gulp-mu-csharp-concat-postworkUsage
import concat from 'gulp-concat';
import csharpConcatPostwork from 'gulp-mu-csharp-concat-postwork';
function csharp() {
return gulp.src('./App_Code/*.cs')
.pipe(concat('combined.cs'))
.pipe(csharpConcatPostwork(isReleaseBuild))
.pipe(gulp.dest('./dist/'));
}API
csharpConcatPostwork(isReleaseBuild, doReleaseTrim = true)
| Parameter | Type | Default | Description |
| ---------------- | --------- | ------- | ------------------------------------------------------------------------------------------- |
| isReleaseBuild | boolean | — | When true, strips comments, blank lines and logging calls. When false, only hoists usings. |
| doReleaseTrim | boolean | true | When true (release builds only), also trims leading/trailing whitespace from each line. |
Streams are not supported; pipe buffered files only.
License
MIT
