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
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,12 +18,12 @@ A small, simple, very easy wrapper around the [require.js optimizer](https://git
18
18
</tr>
19
19
<tr>
20
20
<td>Node Version</td>
21
-
<td>>= 4</td>
21
+
<td>≧ 4</td>
22
22
</tr>
23
23
</table>
24
24
25
25
26
-
##Installation
26
+
##Installation
27
27
28
28
Simply add `gulp-requirejs` as a dev-dependency in your package.json or run
29
29
@@ -64,6 +64,33 @@ gulp-requirejs will emit errors when you don't pass an options object and if the
64
64
65
65
The require.js optimizer itself might also emit errors; unfortunately there's no way of catching them elegantly at the moment.
66
66
67
+
### Source maps
68
+
69
+
When source maps are enabled via the r.js `generateSourceMaps` option the stream returned by `rjs()` contains an additional file named the same as the `out` option with `.map` appended.
70
+
71
+
Use [gulp-sourcemaps](https://www.npmjs.com/package/gulp-sourcemaps) to use this file
72
+
in your gulp configuration:
73
+
74
+
```javascript
75
+
var gulp =require('gulp'),
76
+
rjs =require('gulp-requirejs')
77
+
sourcemaps =require('gulp-sourcemaps');
78
+
79
+
gulp.task('requirejsBuild', function() {
80
+
returnrjs({
81
+
baseUrl:'path/to/your/base/file.js',
82
+
out:'FILENAME_TO_BE_OUTPUTTED',
83
+
generateSourceMaps:true,
84
+
shim: {
85
+
// standard require.js shim options
86
+
},
87
+
// ... more require.js options
88
+
})
89
+
.pipe(sourcemaps.init({loadMaps:true})) // initialize gulp-sourcemaps with the existing map
90
+
.pipe(sourcemaps.write()) // write the source maps
91
+
.pipe(gulp.dest('./deploy/')); // pipe it to the output DIR
0 commit comments