-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
1.7.0 added "Leading . now closes all open calls, allowing for simpler chaining syntax."
This is great, but I may have just stumbled on a bug with that when using the ternary operator and an object argument.
gulp.task 'stylus', ->
gulp.src [
'./src/stylus/vars.styl'
'./src/stylus/**/*.styl'
]
.pipe if argv.sourcemaps then require('gulp-sourcemaps').init() else gutil.noop()
.pipe require('gulp-concat') 'styles.styl'
.pipe require('gulp-stylus')
use: require('nib')()
.pipe if isLocal() then gutil.noop() else require('gulp-minify-css')
compatibility: '' # Empty string is IE9+ (this is default)
.pipe if argv.sourcemaps then require('gulp-sourcemaps').write() else gutil.noop()
.pipe gulp.dest './dist/css'This is coming out as
// Generated by CoffeeScript 1.9.2
gulp.task('stylus', function() {
return gulp.src(['./src/stylus/vars.styl', './src/stylus/**/*.styl']).pipe(argv.sourcemaps ? require('gulp-sourcemaps').init() : gutil.noop()).pipe(require('gulp-concat')('styles.styl')).pipe(require('gulp-stylus')({
use: require('nib')()
})).pipe(isLocal() ? gutil.noop() : require('gulp-minify-css')({
compatilibilty: ''
}).pipe(argv.sourcemaps ? require('gulp-sourcemaps').write() : gutil.noop())).pipe(gulp.dest('./dist/css'));
});I was expecting
compatibility: ''object to be an argument torequire('gulp-minify-css')-- in this case the result is as expected.- the dot at the start of the next line to close both the ternary and the
pipe()from the preceding line -- in this case the result is not as expected: the next.pipe()is chained on the end of thegulp-minify-cssobject.
Note that the gulp-stylus pipe above also receives an object as an argument but does not have a ternary. This one compiles as I expect.
Note also that the gulp-sourcemaps pipes have ternaries but no object argument, and these ones also compile as I expect.
So it seems it's a combination of the tenary and the object argument on a new line.
Is this a bug or am I understanding something incorrectly?
Metadata
Metadata
Assignees
Labels
No labels