Comments (8)
How does .on('error', console.error))
look?
from gulp-coffee.
Same output with console.error.
Okay, so this prints correctly:
I told a lie, they were all broken. At some stage while I was playing with different permutations I though I had it working with the following code, but no longer. I'm not even sure this is a gulp-coffee problem now, as it's working fine in my backend project.
gulp.task('scripts', function (done) {
return gulp.src(appSrc.scripts)
.pipe(coffee())
.on('error', util.log)
.pipe(gulp.dest(compileDest.scripts))
.pipe(size())
;
});
And both of these print output as above:
gulp.task('scripts', function (done) {
return gulp.src(appSrc.scripts)
.pipe(coffee())
.on('error', util.log)
.pipe(gulp.dest(compileDest.scripts))
.pipe(size())
;
});
gulp.task('scripts', function (done) {
return gulp.src(appSrc.scripts)
.pipe(coffee().on('error', util.log))
.pipe(gulp.dest(compileDest.scripts))
.pipe(size())
;
});
from gulp-coffee.
Different versions of gulp-util? Are you sure everything is up to date with the latest?
from gulp-coffee.
I peeked into gulp-util (3.0.6) myself and found that for whatever reason, the error is not being formatted toString()
. This is is how I worked around it in my gulpfile:
$ = require('gulp-load-plugins')()
errorHandler = (error) -> $.util.log error.toString()
# Inside the task...
.pipe($.coffee(bare: true).on('error', errorHandler))
from gulp-coffee.
@edmundito Something that needs to be fixed in gulp-util? What were your findings?
from gulp-coffee.
Yes, this is mainly related to the implementation of the log()
function in gulp-util 3.0.6. I've noticed that master is currently a bit different, however what I found is that it has to do with the behavior of console.log
in Node (as well as Chrome and Safari). console.log
seems to not respect the toString
declaration when outputting objects by themselves:
$ node
> function Cls() {}; Cls.prototype.toString = function () { return 'the string'; }
[Function]
> var c = new Cls()
undefined
> console.log(c)
Cls {}
undefined
> console.log(c.toString())
the string
undefined
> console.log('' + c)
the string
undefined
> console.log.apply(console, [c, c, c])
Cls {} Cls {} Cls {}
This could also be the cause behind the result in gulpjs/gulp-util#74.
from gulp-coffee.
The PluginError class is a disaster in gulp-util right now - there are plans to replace it with something simpler called BetterError but I haven't had time to dedicate to it.
With that - I'd take a PR to fix this issue in gulp-util if any of you have time.
from gulp-coffee.
Closing, this was split out of gulp-util into the plugin-error
module and we use that now. Any fixes for formatting should go there.
from gulp-coffee.
Related Issues (20)
- Let's bump new version! HOT 5
- Converts variables with @$ to _at_$ HOT 6
- What's the canonical way to do partial rebuilds? HOT 1
- Error handler being ignored HOT 3
- Support the --join option HOT 5
- How can I include file ? HOT 1
- why does gulp-coffee uglify the compiled *.js file under 'build/' using gulp-coffee HOT 2
- Latest version of Coffeescript HOT 2
- gulp-coffee won't compile after an error occured(and handled) when used with gulp-watch HOT 4
- do sourcemaps still work? HOT 3
- Update coffee-script dependency HOT 2
- Cofeescript2 support? HOT 5
- Update Node versions tested in CI
- Remove lock files HOT 2
- Update repo location HOT 1
- coffeescript 2 with transpile + inlined source maps? HOT 9
- How not to strip empty lines? HOT 2
- remove gulp-util using the following API replacements HOT 1
- Needs new release to remove merge vulnerability HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-coffee.