-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.atom-build.js
More file actions
31 lines (31 loc) · 928 Bytes
/
.atom-build.js
File metadata and controls
31 lines (31 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module.exports = {
cmd: 'sass',
name: 'Sass',
args: ['{FILE_ACTIVE}', '{FILE_ACTIVE_PATH}/{FILE_ACTIVE_NAME_BASE}.css'],
functionMatch: function (output) {
const errorRg = /^Error: .*$/;
const fileRg = /^ ([^\s]+) (\d+):(\d+)/;
// this is the list of error matches that atom-build will process
const errors = [];
let message = 'no message';
output.split(/\r?\n/).forEach(line => {
const err_match = errorRg.exec(line);
if (err_match) {
message = err_match[0];
} else {
// process possible error messages
const file_match = fileRg.exec(line);
if (file_match) {
// map the regex match to the error object that atom-build expects
errors.push({
message,
file: file_match[1],
line: file_match[2],
col: file_match[3]
});
}
}
});
return errors;
}
};