No error reporting?
Closed this issue · 6 comments
I have been trying to set up ember-cli-eyeglass
for my open source app Bookmeister, switching from Ruby Sass.
I guess it's not too surprising that it doesn't compile immediately without errors, but the problem I'm struggling with is that all errors seem to be squelched somewhere inside Broccoli.
So if I make a really simple app.scss
file, like this:
body {
background-color: chartreuse;
}
…everything works just fine. A bookmeister.css
file is created with those contents.
The problem occurs when I try to use my previous setup, as before with partials and Sass libraries, ember build
just stops generating a bookmeister.css
file at all.
I have tried digging a bit into this library, and broccoli-eyeglass beneath it, but I have not been able to figure out which of the two causes the errors to be silenced, so I'm filing this here. I'll try to investigate further on my own, but if anyone had a few pointers on where I should look, I would be grateful.
I've come up with a simple test case for reproducing the error, just load toolkit in your app.scss
like this:
@import 'toolkit';
body {
background-color: chartreuse;
}
This should work, when you have "sass-toolkit": "^2.9.0"
in your package.json, but it fails as described above (no app.css
file generated).
Is sass-toolkit
in your dependencies
or devDependencies
?
Try adding it to dependencies
if it's not already there. This is an issue in eyeglass
that will be fixed in the next release.
That said, even if that does fix your immediate issue, an error should definitely be surfaced.
Thanks for the suggestion, although it seems that was not the problem (or at least not the only one). I'll investigate further when I have time :)
Okay, I'm pretty sure I've found the problem.
In broccoli-eyeglass, in the handleFailure method for the sass compiler, there's a TODO.
At the time of this writing, it reads:
handleFailure: function(details, error) {
var failed = this.events.emit("failed", details, error);
var rethrow = failed.finally(function() {
// TODO: implement fullException
//RSVP.rethrow(error)
});
return RSVP.allSettled([failed, rethrow]);
},
Now, I'm not sure if it is the TODO that needs to be fixed, or ember-cli-eyeglass that needs to listen for the error event emitted here, but I have found a reasonable workaround until either happens – simply add this line to the handleFailure
function:
throw error;
Oh, and the main problem here was that the version of sass-toolkit I had installed needed eyeglass v0.2.0 to work, I've made a PR for that: #3
The error handling has been fixed recently. Sorry for the inconvenience.