I assume this was written this way to be able to catch errors in stylesheets and then if no errors are encountered to load the stylesheet completely. But why not try to load the stylesheet straight away, and then only if their are errors, compile it again to actually get them out?
It appears that
compileStylesheet
is called twice inmodels/Project.server.bones
when a user saves a project. This appears intentional as is evident in theasyncValidate
method: https://github.com/mapbox/tilemill/blob/cc413c9799f3267d8dc8ea385ef0f5b88901630a/models/Project.server.bones#L74-83I assume this was written this way to be able to catch errors in stylesheets and then if no errors are encountered to load the stylesheet completely. But why not try to load the stylesheet straight away, and then only if their are errors, compile it again to actually get them out?
See also #1150