/** * Process CSS file and return CSS as text wrapped in html style tags. * * @see docs/api/functions.md */ function csscrush_inline($file, $options = array(), $tag_attributes = array()) { if (!is_array($options)) { $options = array(); } if (!isset($options['boilerplate'])) { $options['boilerplate'] = false; } $file = csscrush_file($file, $options); if ($file && $file->path) { $tagOpen = ''; $tagClose = ''; if (is_array($tag_attributes)) { $attrs = CssCrush\Util::htmlAttributes($tag_attributes); $tagOpen = "<style{$attrs}>"; $tagClose = '</style>'; } return $tagOpen . file_get_contents($file->path) . $tagClose . "\n"; } }
$input = file_get_contents($args->input_file); } elseif ($stdin = get_stdin_contents()) { $input = $stdin; } else { stdout(manpage()); exit(STATUS_OK); } if ($args->watch && !$args->input_file) { stderr(message('Watch mode requires an input file.', array('type' => 'error'))); exit(STATUS_ERROR); } ################################################################## ## Resolve process options. $configFile = 'crushfile.php'; if (file_exists($configFile)) { $options = CssCrush\Util::readConfigFile($configFile); } else { $options = array(); } if ($args->pretty) { $options['minify'] = false; } foreach (array('boilerplate', 'formatter', 'newlines', 'stat_dump', 'source_map') as $option) { if ($args->{$option}) { $options[$option] = $args->{$option}; } } if ($args->enable_plugins) { $options['plugins'] = parse_list($args->enable_plugins); } if ($args->vendor_target) {