<?php

	error_reporting(0);

	require_once "../../admin/lib/composer.php";
	require_once "../../admin/lib/minify.php";
	require_once "../../admin/lib/common.php";
	require_once "../../admin/lib/debug.php";
	require_once "../../admin/lib/error/error.php";
	require_once "../../admin/lib/include/file.php";
	require_once "../../admin/lib/include/dir.php";


	$dir	= dirname(__FILE__);
	$conf	= CFile::GetJson("../../upload/conf/assets.json");


	$minify = CMinify::newInstance()
		->setTypeCSS()
		->setMinify($conf["css"]["type"] == "prod")
		->setConcatenate($conf["css"]["type"] == "prod")
		->addFiles(			
			array(
				$dir . "/fonts.external.css",
			),
			"first"
		)
		->addFilesByPrefix(
			$dir , 
			"font." , 
			"css" 
		)
		->addFilesByPrefix(
			$dir , 
			"layout." , 
			"css" 
		)
		->addFilesByPrefix(
			$dir , 
			"global." , 
			"css" 
		)
		->addFilesByPrefix(
			$dir , 
			"plugin." , 
			"css" 
		)
		->addFilesByPrefix(
			$dir , 
			"module." , 
			"css" 
		)
		->addFilesByPrefix(
			$dir , 
			"widget." , 
			"css" 
		)
		->addFilesByPrefix(
			$dir , 
			"custom." , 
			"css" 
		)
		->removeFilesBySuffix(
			array(
				".skin.css",
				".skin.ic.css",
				".skin.nc.css"
			)
		)

		->setCacheFile("../../upload/_cache/style-" . $conf["css"]["type"] . "-" . $conf["css"]["ver"] . ".css")
		->setVersion($conf["css"]["ver"])
		->setNoCache(!$conf["css"]["cache"])
		->output();