Skip to content

Commit

Permalink
Run Prettier on README.md (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
pioug committed Aug 2, 2018
1 parent f29fa5d commit 38cac5e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Expand Up @@ -2,7 +2,6 @@

> [Gulp](http://gulpjs.com) plugin to preprocess HTML, JavaScript, and other files based on custom context or environment configuration

## Information

<table>
Expand All @@ -19,7 +18,6 @@
</tr>
</table>


## Usage

### Install
Expand All @@ -28,24 +26,25 @@
npm install gulp-preprocess --save-dev
```


## Examples

#### Gulpfile

```js
var preprocess = require('gulp-preprocess');
var preprocess = require("gulp-preprocess");

gulp.task('html', function() {
gulp.src('./app/*.html')
.pipe(preprocess({context: { NODE_ENV: 'production', DEBUG: true}})) //To set environment variables in-line
.pipe(gulp.dest('./dist/'))
gulp.task("html", function() {
gulp
.src("./app/*.html")
.pipe(preprocess({ context: { NODE_ENV: "production", DEBUG: true } })) // To set environment variables in-line
.pipe(gulp.dest("./dist/"));
});

gulp.task('scripts', function() {
gulp.src(['./app/*.js'])
gulp.task("scripts", function() {
gulp
.src(["./app/*.js"])
.pipe(preprocess())
.pipe(gulp.dest('./dist/'))
.pipe(gulp.dest("./dist/"));
});
```

Expand Down Expand Up @@ -73,37 +72,38 @@ gulp.task('scripts', function() {
#### Example JavaScript File

```js
var configValue = '/* @echo FOO */' || 'default value';
var configValue = "/* @echo FOO */" || "default value";

// @ifdef DEBUG
someDebuggingCall()
someDebuggingCall();
// @endif
```

CoffeeScript files are also supported.


#### More Examples

`gulp-preprocess` uses [preprocess](https://github.com/jsoverson/preprocess#directive-syntax). More examples can be found in its [README](https://github.com/jsoverson/preprocess#directive-syntax).


## API

### preprocess(options)

#### options.context

Type: `Object`
Default: `{}`

Context for directives used in your preprocessed files. The default context consists of the current user environment variables. Custom context is merged with `process.env`.

#### options.includeBase

Type: `String`

Base directory for included files. By default, the path to included files is relative to the file currently being processed.

#### options.extension

Type: `String`

Override the file extension. This determines what [regular expressions are used for comments](https://github.com/jsoverson/preprocess/blob/master/lib/regexrules.js). You may wish to do this if you are using a custom extension or need to force a particular comment syntax (for example, to allow HTML-style comments in `.php` files).
Expand Down

0 comments on commit 38cac5e

Please sign in to comment.