diff --git a/README.md b/README.md index a74c7b8..0c23aa9 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ > [Gulp](http://gulpjs.com) plugin to preprocess HTML, JavaScript, and other files based on custom context or environment configuration - ## Information @@ -19,7 +18,6 @@
- ## Usage ### Install @@ -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/")); }); ``` @@ -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).