/** * @param Event $event * * @throws \InvalidArgumentException */ public static function generateCSS(Event $event) { $extra = $event->getComposer()->getPackage()->getExtra(); static::validateConfiguration($extra); $processor = new Processor($event->getIO()); foreach ($extra[static::CONFIG_MAIN_KEY] as $config) { foreach ($config[static::OPTION_KEY_INPUT] as $inputSource) { $processor->attachFiles(static::resolvePath($inputSource, getcwd()), static::resolvePath($config[static::OPTION_KEY_OUTPUT], getcwd())); } $formatter = isset($config[static::OPTION_KEY_FORMATTER]) ? $config[static::OPTION_KEY_FORMATTER] : static::DEFAULT_OPTION_FORMATTER; $processor->processFiles($formatter); } $processor->saveOutput(); }
/** * @see ScriptHandler::processFiles * @test */ public function saveOutput() { $processor = new Processor($this->io); $expectedOutputFile = $this->getCacheDirectory() . '/' . __FUNCTION__ . '.css'; @unlink($expectedOutputFile); $processor->attachFiles($this->getSharedFixturesDirectory() . '/scss', $expectedOutputFile); $processor->processFiles(Processor::FORMATTER_COMPRESSED); $processor->saveOutput(); $this->assertFileExists($expectedOutputFile); }