Browse Source

Robo task for rebuilding stylesheet only

microsub
J. King 5 years ago
parent
commit
c334390db1
  1. 26
      RoboFile.php

26
RoboFile.php

@ -195,7 +195,6 @@ class RoboFile extends \Robo\Tasks {
* Daux's theme changes * Daux's theme changes
*/ */
public function manualTheme(array $args): Result { public function manualTheme(array $args): Result {
$postcss = escapeshellarg(realpath(self::BASE."node_modules/.bin/postcss"));
$languages = ["php", "bash", "shell", "xml", "nginx", "apache"]; $languages = ["php", "bash", "shell", "xml", "nginx", "apache"];
$themesrc = realpath(self::BASE."docs/theme/src/").\DIRECTORY_SEPARATOR; $themesrc = realpath(self::BASE."docs/theme/src/").\DIRECTORY_SEPARATOR;
$themeout = realpath(self::BASE."docs/theme/arsse/").\DIRECTORY_SEPARATOR; $themeout = realpath(self::BASE."docs/theme/arsse/").\DIRECTORY_SEPARATOR;
@ -204,10 +203,8 @@ class RoboFile extends \Robo\Tasks {
// start a collection; this stops after the first failure // start a collection; this stops after the first failure
$t = $this->collectionBuilder(); $t = $this->collectionBuilder();
$tmp = $t->tmpDir().\DIRECTORY_SEPARATOR; $tmp = $t->tmpDir().\DIRECTORY_SEPARATOR;
// install dependencies via Yarn // rebuild the stylesheet
$t->taskExec("yarn install"); $t->addCode([$this, "manualCss"]);
// compile the stylesheet
$t->taskExec($postcss)->arg($themesrc."arsse.scss")->option("-o", $themeout."arsse.css");
// copy JavaScript files from the Daux theme // copy JavaScript files from the Daux theme
foreach(glob($dauxjs."daux*") as $file) { foreach(glob($dauxjs."daux*") as $file) {
$t->taskFilesystemStack()->copy($file, $themeout.basename($file), true); $t->taskFilesystemStack()->copy($file, $themeout.basename($file), true);
@ -259,4 +256,23 @@ class RoboFile extends \Robo\Tasks {
// execute the collection // execute the collection
return $t->run(); return $t->run();
} }
/** Rebuilds the manual theme's stylesheet only
*
* This requires Node and Yarn to be installed.
*/
public function manualCss(): Result {
$postcss = escapeshellarg(realpath(self::BASE."node_modules/.bin/postcss"));
$themesrc = realpath(self::BASE."docs/theme/src/").\DIRECTORY_SEPARATOR;
$themeout = realpath(self::BASE."docs/theme/arsse/").\DIRECTORY_SEPARATOR;
// start a collection; this stops after the first failure
$t = $this->collectionBuilder();
$tmp = $t->tmpDir().\DIRECTORY_SEPARATOR;
// install dependencies via Yarn
$t->taskExec("yarn install");
// compile the stylesheet
$t->taskExec($postcss)->arg($themesrc."arsse.scss")->option("-o", $themeout."arsse.css");
// execute the collection
return $t->run();
}
} }

Loading…
Cancel
Save