Add qa:lint-css task, incorporate style linting into current flow

[MAILPOET-1917]
This commit is contained in:
Ján Mikláš
2019-03-20 16:13:00 +01:00
committed by M. Shull
parent f7c34c8b5c
commit fd2c90e6d3
3 changed files with 23 additions and 3 deletions

View File

@ -59,8 +59,14 @@ class RoboFile extends \Robo\Tasks {
function watchCss() {
$css_files = $this->rsearch('assets/css/src/', array('scss'));
$this->taskWatch()
->monitor($css_files, function() {
$this->compileCss();
->monitor($css_files, function($changedFile) {
$file = $changedFile->getResource()->getResource();
$this->taskExecStack()
->stopOnFail()
->exec('npm run stylelint -- "' . $file . '"')
->exec('npm run scss')
->exec('npm run autoprefixer')
->run();
})
->run();
}
@ -313,6 +319,7 @@ class RoboFile extends \Robo\Tasks {
return $this->qaCodeSniffer('all');
});
$collection->addCode(array($this, 'qaLintJavascript'));
$collection->addCode(array($this, 'qaLintCss'));
return $collection->run();
}
@ -324,6 +331,10 @@ class RoboFile extends \Robo\Tasks {
return $this->_exec('npm run lint');
}
function qaLintCss() {
return $this->_exec('npm run stylelint -- "assets/css/src/components/**/*.scss"');
}
function qaCodeSniffer($severity='errors') {
if ($severity === 'all') {
$severityFlag = '-w';