How to use the gulp-sourcemaps.init function in gulp-sourcemaps

To help you get started, we’ve selected a few gulp-sourcemaps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dsebastien / midnightLightV2 / gulp / tasks / scripts-typescript.js View on Github external
gulp.task('scripts-typescript', 'Transpile TypeScript to ES6, include references to library and app .d.ts files and generate sourcemaps', () =>{

	// references:
	// https://www.npmjs.com/package/gulp-typescript
	let tsProject = ts.createProject('tsconfig.json', {
		typescript: require('typescript'), // override the typescript version by that defined in package.json

		// configuration defined in tsconfig.json
		// other overrides here if needed
		// http://json.schemastore.org/tsconfig
		// https://github.com/Microsoft/TypeScript/wiki/Compiler%20Options
	});

	let tsResult = utils.plumbedSrc(config.typescript.src) // handle errors nicely (i.e., without breaking watch)
		.pipe(sourcemaps.init())
		.pipe(ts(
			tsProject
		));

	// Output files
	tsResult.dts.pipe(gulp.dest(config.typescript.dest));

	return tsResult.js

		.pipe(sourcemaps.write('.', { // use '.' to write the sourcemap to a separate file in the same dir
			// sourcemaps need to be written to separate files otherwise Babel freaks out (!)
			includeContent: false, // alternative: include the contents and remove sourceRoot. Avoids issues but prevents from editing the sources directly in the browser
			sourceRoot: '/' // use an absolute path because we have scripts in different subpaths
		}))
		// Output files
		.pipe(gulp.dest(config.typescript.dest))
github latestchatty / chatty / src / old / gulp / tasks / build-js.js View on Github external
if (debug) {
            bundler.on('error', function(err) {
                gutil.log(gutil.colors.red('Browserify error:'), err)
            })
        }

        var bundleStream = bundler
            .pipe(source(config.jsBundleInput))
            .pipe(ngAnnotate())

        var templateStream = gulp.src(config.views)
            .pipe(templateCache({module: config.moduleName}))

        merge2(bundleStream, templateStream)
            .pipe(buffer())
            .pipe(gulpif(!debug, sourcemaps.init()))
            .pipe(concat(config.jsBundleName))
            .pipe(gulpif(!debug, uglify()))
            .pipe(gulpif(!debug, sourcemaps.write('.')))
            .pipe(gulp.dest(config.dist))
    }
github Style-Validator / style-validator / gulpfile.js View on Github external
function autoprefix() {
	return gulp.src('./src/**/*.css')
		.pipe(sourcemaps.init())
		.pipe(postcss([ autoprefixer({ browsers: ['last 3 versions'] }) ]))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('./dest'));
}
github antonybudianto / angular-starter / config / gulp / tasks / typescript.js View on Github external
function compileTs(files, watchMode) {
    watchMode = watchMode || false;

    var tsProject = ts.createProject('tsconfig.json');
    var allFiles = [].concat(files, typingFiles);
    var res = gulp.src(allFiles, {
            base: config.src,
            outDir: config.tmp
        })
        .pipe(tslint({
            formatter: 'verbose'
        }))
        .pipe(tslint.report())
        .pipe(sourcemaps.init())
        .pipe(tsProject())
        .on('error', function () {
            if (watchMode) {
                return;
            }
            process.exit(1);
        });
    return res.js
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(config.tmp));
}
github pixeldesu / surfbird / gulpfile.js View on Github external
gulp.task('js', function () {
  var b = browserify({
    entries: './app/_js/main.js',
    debug: true,
    bundleExternal: false,
    builtins: false,
    commondir: false,
    insertGlobals: 'global',
    transform: [vueify, babelify]
  })

  return b.bundle()
    .pipe(source('app.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
      .pipe(uglify())
      .on('error', gutil.log)
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./app/assets/js/'))
})
github robbie-c / js-set-functions / gulpfile.js View on Github external
gulp.task('uglified', function () {
  return browserify(browserifyConfig)
    .bundle()
    .pipe(source('set-functions.min.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
    .pipe(uglify())
    .on('error', gutil.log)
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./dist/js/'));
});
github phodal / aofe.code / chapter04 / gulp-examples / gulpfile.js View on Github external
gulp.task('js', function(){
  return gulp.src('src/javascript/*.js')
    .pipe(sourcemaps.init())
    .pipe(concat('app.min.js'))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('build/js'))
});
github mgechev / angular2-github-app-bootstrap / gulpfile.js View on Github external
gulp.task('build.js.dev', function () {
  var result = gulp.src('./app/**/*ts')
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(tsc(tsProject));

  return result.js
    .pipe(sourcemaps.write())
    .pipe(template({ VERSION: getVersion() }))
    .pipe(gulp.dest(PATH.dest.dev.all));
});
github GreyRook / gown.js / gulp / util / bundle.js View on Github external
function rebundle(devBundle) {
    if (devBundle) {
        gutil.log('Starting dev rebundle...');
    }

    var debug, min;

    debug = sourcemaps.init({loadMaps: true});
    debug.pipe(sourcemaps.write('./', {sourceRoot: './'}))
        .pipe(gulp.dest(paths.out));

    min = rename({ suffix: '.min' });
    min.pipe(sourcemaps.init({loadMaps: true}))
        .pipe(uglify())
        .pipe(sourcemaps.write('./', {sourceRoot: './', addComment: false}))
        .pipe(gulp.dest(paths.out));

    var stream = this.bundle()
        .on('error', handleErrors.handler)
        .pipe(handleErrors())
        .pipe(source('gown-full.js'))
        .pipe(buffer());

    if (devBundle) {

gulp-sourcemaps

Sourcemap support for gulpjs.

ISC
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis