# gulp-code-switch

> This is analog for grunt-code-switch package

Latest version **1.0.1** (published 2016-08-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install gulp-code-switch
pnpm add gulp-code-switch
yarn add gulp-code-switch
bun add gulp-code-switch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-08-29 |
| First published | 2016-08-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | vetoshko |

## Links

- npm: https://www.npmjs.com/package/gulp-code-switch
- npm.io page: https://npm.io/package/gulp-code-switch

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ^2.0.1
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.7

## Recent versions

- 1.0.1 (latest) — 2016-08-29
- 1.0.0 — 2016-08-29

## README

**Example**

```javascript
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:
```HTML
<!-- dev -->
<div> DEV version </div>
<!-- dev:end -->
<!-- prod --#>
<div> PROD version </div>
<!-- prod:end -->
```
Example for JS file:
```JS
/* dev */
var devServerUrl = "www.dev-yoursite.com";
/* dev:end */
/* prod *#/
var prodServerUrl = "www.prod-yoursite.com";
/* prod:end */
```

---
_Source: https://npm.io/package/gulp-code-switch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
