1.0.1 • Published 8 years ago

gulp-code-switch v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

Example

gulp.task('test', function () {
	return gulp.src('./index.html')
		.pipe(codeSwitch({
			blocks: [{
				code_tag: 'dev'
			}, {
				code_tag: 'prod'
			}],
			param: 'dev'
		}))
		.pipe(gulp.dest('./dev'));
});

Blocks type: Array A array block defining the possible switches. It contains 'code_tag'

Param type: String A parameter for choosing code block

Example for HTML file:

<!-- dev -->
<div> DEV version </div>
<!-- dev:end -->
<!-- prod --#>
<div> PROD version </div>
<!-- prod:end -->

Example for JS file:

/* dev */
var devServerUrl = "www.dev-yoursite.com";
/* dev:end */
/* prod *#/
var prodServerUrl = "www.prod-yoursite.com";
/* prod:end */