How to use the init function from gulp-sourcemaps

Find comprehensive JavaScript gulp-sourcemaps.init code examples handpicked from public code repositorys.

21
22
23
24
25
26
27
28
29
30
31
 */
function wxss(wxssFileList) {
  if (!wxssFileList.length) return false


  return gulp.src(wxssFileList, {cwd: srcPath, base: srcPath})
    .pipe(gulpif(wxssConfig.less && wxssConfig.sourcemap, sourcemaps.init()))
    .pipe(gulpif(wxssConfig.less, less({paths: [srcPath]})))
    .pipe(rename({extname: '.wxss'}))
    .pipe(gulpif(wxssConfig.less && wxssConfig.sourcemap, sourcemaps.write('./')))
    .pipe(_.logger(wxssConfig.less ? 'generate' : undefined))
fork icon9
star icon32
watch icon2

73
74
75
76
77
78
79
80
81
82
    `node_modules/flatbuffers/js/flatbuffers.mjs`,
    `node_modules/text-encoding-utf-8/package.json`,
    `node_modules/text-encoding-utf-8/src/encoding.js`,
    `${src}/**/*.js` /* <-- then source globs */
], { base: `./` }),
sourcemaps.init(),
closureCompiler(createClosureArgs(entry_point, externs)),
// rename the sourcemaps from *.js.map files to *.min.js.map
sourcemaps.write(`.`, { mapFile: (mapPath) => mapPath.replace(`.js.map`, `.${target}.min.js.map`) }),
gulp.dest(out)
fork icon25
star icon13
watch icon12

+ 3 other calls in file

93
94
95
96
97
98
99
100
101
102
 * Add JS compilation options to gulp pipe
 */
jsChannel: function () {
    var config = this.config.compile;
    return lazypipe().pipe(function () {
        return gulpif(config.jsSourcemaps, sourcemaps.init({loadMaps: true, debug: config.debug}));
    }).pipe(function () {
        return gulpif(config.jsMinify, terser());
    }).pipe(function () {
        return gulpif(config.jsSourcemaps, sourcemaps.write('./'));
fork icon0
star icon0
watch icon1

+ 19 other calls in file

109
110
111
112
113
114
115
116
117
118
// pipe plugins to map
// create source map file before writing to destination
// note: all plugins must be compatible with sourcemaps to work
export const styles = () => {
  return src(paths.styles.src)
    .pipe(gulpif(!PRODUCTION, sourcemaps.init()))
    .pipe(sass().on('error', sass.logError))
    .pipe(gulpif(PRODUCTION, postcss([ autoprefixer ])))
    .pipe(gulpif(PRODUCTION, cleanCss({compatibility:'ie10'}))) 
    .pipe(gulpif(!PRODUCTION, sourcemaps.write()))   
fork icon0
star icon0
watch icon1

+ 13 other calls in file