-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring in new sourcemap system #356
Comments
Working on this now |
Have been flailing with trying to get source maps to work with gulp for the last few hours, then stumbled upon this — :thumbsup: anything I can do to help? |
Is this the official issue for source maps (concat)? Bounced around between 5 tickets before finding this. |
@patrickheeney for all source maps, not just concat |
Yes
|
Can't wait any more for this feature... |
Please add this! |
+1 |
Any progress or details on how it might work? |
Yeah, this seems to be the right way of doing things. I would LOVE to be able to load my js files, minify them and then concat them with "vendor" files that come already minified with their map file. It would help so very much. |
@floridoo is also helping out here. |
I believe I will be very free this week. If I can be of any help I would gladly give a hand too. |
@terinjokes this seems to be a good way to do it and in particular better than my hack on gulp-coffee at gulp-community/gulp-coffee#24 Is there anything people such as myself can do to help get this finished and released to gulp users ? |
What we're going to do is:
We're working on the developer-facing side to allow working with gulp source maps easier. @floridoo has taken these ideas and developed floridoo/gulp-sourcemaps. |
@terinjokes That really sounds great. The big question mark that still stays is: we seem to be a lot wanting to help getting this ready in a timely fashion (either because we need this or because we like the idea). Is there anything we, the community at large, can do about this issue? I personally prefer gulp over grunt but I do have my actual build stack on grunt. I really want to create a new stack over gulp. When I was looking into what I would need to do my ideal stack on gulp, I found this bug. It is really a must have for me. My new ideal stack is a lot more sourcemap aware that what I can do with gulp today (or with grunt for that matter). If we could let's say cut the code in parts with clearly identified APIs, different people could easily handle each one separately. We can open separate bugs to track the whole thing in parts and wait for all of them to be closed before closing the "meta bug" (this one?) after the small plumbing left is done. Or maybe this is too small (or to closely interdependent) to make this work? |
@terinjokes I think making a list of modules that need to be completed with some basic specs would be prudent so other people can pitch in |
@contra sure thing. there's already one open ticket on gulp-sourcemaps, but I'll work on specs for other modules. |
@terinjokes I like this idea too, so I tried implement it's support for Know I need to implement support for |
@Termina1 check out these forks -> https://github.com/floridoo/gulp-sourcemap-test/blob/master/package.json#L14-L15 |
@Termina1 I'm working on |
If you want to help, please have a look at floridoo/gulp-sourcemaps, join the discussions in the issues and add your own ideas / issues / pull requests. Thank you! |
If someone, like me, need to create the maps files and the javascript from coffeescript files what are into a tree structure, this workaround may help https://gist.github.com/thiagomata/1f6a7c3b47bcb7c16399 |
@floridoo @terinjokes can you post a TODO here so we know what needs to be done to close this out? |
Heya Gulp Dudes: Wonderful work on Gulp + plugin ecosystem; big supporter / lover of the build sys. Just noting, similiar to @thiagomata - when using coffeescript and src globbing for all directories and files in the form of: |
@dylan-baskind What you describe is a bug in |
@jessepollak anything up with the browserify side of things ? |
This has largely shifted to something existing in plugins, rather than core. Is there anything other than documentation that is blocking the closure of this? Working on the documentation. 😄 |
Documentation and we can close this. I just want to say thanks to everyone who contributed to making this one happen - @floridoo you did an awesome job. We have the best sourcemaps of any build tool. |
👍 It's really good :) |
Yeah I concur with that. Best sourcemap in a build tool 👍. Ever. |
Can someone explain how to uglify, then concat and finally generate the source map? I cannot seem to get it working. I see the logical error but I am not seeing anything in the API's that would explain how to accomplish this and from the comments above I gather that it is possible. gulp.src(['src/app.js', 'src/**/*.js'])
.pipe(sourcemaps.init())
.pipe(uglify({
compress: {
negate_iife: false
}
}))
.pipe(concat("app.concat.js"))
.pipe(rename('app.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('public/js')); |
@thiswildorchid concat before uglify. Check stackoverflow questions and related repositories docs & issues: --edit |
Only thing is that the source map breakpoints don't work :( in chrome (I have only tried chrome) |
@thiswildorchid that's inevitable to some degree – uglification removes line breaks and thus drastically reduces the number of places you can have breakpoints. I run separate What I then realise is that I want to be able to debug in development, but I don't care about source maps in build. You can make as many of these conditional pipes as you like: var browserify = require( 'browserify' );
var buffer = require( 'vinyl-buffer' );
var maps = require( 'gulp-sourcemaps' );
var source = require( 'vinyl-source-stream');
var uglify = require( 'gulp-uglify' );
var dev = false;
function noop(){}
gulp.task( 'build', function(){
// Do stuff, including browserify
} );
gulp.task( 'dev', function(){
dev = true;
// Do stuff, including browserify
} );
gulp.task( 'browserify', function(){
var opts = {};
if( dev ) opts.debug = true;
return browserify( './src/js/app.js', opts )
.bundle()
.pipe( source( 'app.js' ) )
.pipe( buffer() )
.pipe( dev ? maps.init( { loadMaps : true } ) : noop() )
.pipe( dev ? noop() : uglify() )
.pipe( dev ? maps.write() : noop() )
.pipe( gulp.dest( './build/js/' ) )
.pipe( dev ? sync.reload( { stream : true } ) : noop() )
.on( 'error', function( e ){
this.emit( 'end' );
} );
} ); |
That was exactly what I was thinking on doing, and have done before, thank you. |
@barneycarroll i do this in other way. I have var
gulp = require('gulp'),
gIf = require('gulp-of'),
// more and more...
uglify = requier('gulp-uglify')
;
// I prefer minimist to parse arguments
var release = !!args.release;
gulp.task('scripts:app', function () {
return gulp.src('src/app.js')
.pipe(gIf(!release, sourcemaps.init()))
.pipe(es6moduleTranspile(...))
.pipe(gIf(release, uglify()))
.pipe(gIf(!release, sourcemaps.write())
;
}); You may also want to use lazy-pipe for DRY. |
I can't merge two streams together with source maps :( Means I can only use gulp for really basic configurations. |
e.g. How to merge the two streams and concatenate the source maps? var gulp = require('gulp')
var sourcemaps = require('gulp-sourcemaps')
var traceur = require('gulp-traceur')
var concat = require('gulp-concat')
var merge = require('merge-stream')
gulp.task('default', function() {
// how to do this? this doesn't work...
merge(
gulp.src(['app/*.js', 'app/*/*.js'])
.pipe(sourcemaps.init())
.pipe(traceur())
.pipe(concat('smut.js'))
.pipe(sourcemaps.write()),
gulp.src('bootstrap.js')
.pipe(sourcemaps.init()) // ??
.pipe(sourcemaps.write())
)
.pipe(sourcemaps.init()) // ??
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/assets'))
}) I want the final merged asset to contain source maps. plumber/gobble do this easily. |
Just needs docs to close this out :( @floridoo Do you have any time to write a quick markdown on how to put sourcemaps in your library? |
@floridoo Exactly that |
Related: #843 |
The text was updated successfully, but these errors were encountered: