You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-24Lines changed: 23 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,11 @@ gulp.src("./templates/*.ejs")
23
23
}))
24
24
.pipe(gulp.dest("./dist"))
25
25
```
26
-
If you want to use `gulp-ejs` in a watch/livereload task, you may want to avoid gulp exiting on error when, for instance, a partial file is `ENOENT`.
26
+
27
+
### Watch mode error handling (for gulp v3 or below)
28
+
29
+
If you want to use `gulp-ejs` in a watch/livereload task, you may want to avoid gulp exiting on error when, for instance, a partial file is `ENOENT` or an ejs syntax error.
30
+
27
31
Here's an example on how to make it work:
28
32
29
33
```javascript
@@ -38,29 +42,23 @@ gulp.src('./templates/*.ejs')
38
42
```
39
43
This will make gulp log the error and continue normal execution.
40
44
41
-
If you want to specify the extension of output files, set the ext option:
45
+
**Please note that you don't need to do this for Gulp v4.**
**Note:** As of version 4, the exported ejs object was renamed from `ejs` to `__EJS__`.
58
+
61
59
## API
62
60
63
-
### ejs(data, options, settings)
61
+
### ejs(data, options)
64
62
65
63
#### data
66
64
Type: `hash`
@@ -78,20 +76,21 @@ A hash object for ejs options.
78
76
79
77
For more info on `ejs` options, check the [project's documentation](https://github.com/mde/ejs).
80
78
81
-
#### settings
82
-
Type: `hash`
83
-
Default: `{}`
84
-
85
-
A hash object to configure the plugin.
79
+
### Renaming file extensions
86
80
87
-
##### settings.ext
88
-
Type: `String`
89
-
Default: `undefined`
81
+
As of version 4, the third api parameter `settings` was removed. You can no longer provide an extension. This is because it falls out of the scope of `gulp-ejs`. So if you need to save the file with a different extension you can use [gulp-rename](https://npmjs.com/package/gulp-rename).
90
82
91
-
Defines the file extension that will be appended to the filename. If no extension is provided, the same extension of the input file will be used.
83
+
Here's an example for template files with `.ejs`extension that are rendered into `.html` files:
92
84
93
-
**Note:** As of `v2.0.0` the output file extension is no longer `.html` by default, you need to specify it, otherwise it will have the same extension of the input file.
0 commit comments