Skip to content

Instantly share code, notes, and snippets.

@grasmash
Last active August 19, 2016 21:09
Show Gist options
  • Save grasmash/1b56e1dcf2f46a8465ae to your computer and use it in GitHub Desktop.
Save grasmash/1b56e1dcf2f46a8465ae to your computer and use it in GitHub Desktop.
Executes compile sass for a project
<?php
namespace Acquia\Console\Command;
use Acquia\Utilities;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
/**
* Compiles theme SASS.
*/
class InitializeRepository extends Command {
/**
* @see http://symfony.com/doc/current/components/console/introduction.html#creating-a-basic-command
*/
protected function configure() {
$this
->setName('theme:compile-sass')
->setDescription('Compiles theme sass')
->addArgument(
'theme-dir',
InputArgument::REQUIRED,
'In which directory does your theme reside?'
);
// Pseudo-code to ensure that this command inherits globally shared arguments for things like dynamic handling of errors, warnings, etc.
// NOTE: we would need to build this functionality.
$this->addGlobalArgs()
}
/**
* @{inheritdoc}
*
* @throws \RuntimeException
*/
protected function execute(InputInterface $input, OutputInterface $output) {
parent::execute($input, $output);
// Pseudo-code for recursive dependency checking.
// NOTE: we would need to build this functionality.
$this->dependencies = array(
'composer-install',
);
$this->runDependencies();
$theme_dir = $this->input->getArgument('theme-dir');
$this->executeProcess("sass compile $theme_dir");
// Pseudo-code to dynamically handle warning or errors based globally inherited arguments.
// NOTE: we would need to build this functionality.
$this->handleWarningsAndErrors();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment