Componette

Componette

GalekDeprecated

GalekDeprecated / CombineFiles

[ABANDONED] Combine files js, css, less,... for SEO

download-cloud-line composer require galek/combine-files

![Travis] (https://travis-ci.org/JanGalek/combine-files.svg?branch=master) Downloads this Month

CombineFiles

Fast resolve for Google PageSpeed Insights combine warning (more css files). Now you can use generate for merge all files what you need to one file.

Package Installation

The best way to install Combine Files is using Composer:

$ composer require galek/combine-files

Packagist - Versions

or manual edit composer.json in your project

"require": {
    "galek/combine-files": "^1"
}

Importat settings

You need set rootPath to parent directory of your path

$rootPath = __DIR__;

Also you set path/directory where are your files to merge.

$path = 'css';

Example

  $path = 'css';
  $root = __DIR__;
  $basic = new \Galek\Utils\CombineFiles($root, $path);
  $basic->addFile('main.css');
  $basic->addFile('top.css');
  $basic->addFile('bot.css');
  ?>
  <link rel="stylesheet" type="text/css" href="https://github.com/GalekDeprecated/CombineFiles/blob/master/<?php echo $basic; ?>">

  <h1>Tested</h1>

Example with Nette Extension

extensions:
	css: \Galek\Utils\CombineFiles\DI\Extension
	js: \Galek\Utils\CombineFiles\DI\Extension

css:
	root: ::constant(WWW_DIR) // we can use constant, which we defined for example at index.php
	localPath: 'css'
	files:
		- style.min.css
		- nittro.full.min.css

js:
	root: ::constant(WWW_DIR)
	localPath: 'js'
	name: 'myCombinedFile' //We can named outside file
	files:
		- main.js
		- nittro.full.min.js
    public function startup()
    {
        parent::startup();
        $this->cssCombinator = $this->context->getService('css.combineFiles');
    }

    protected function beforeRender()
    {
        parent::startup();
        $this->template->cssCombined = $this->cssCombinator;
    }
    <head>
        <link rel="stylesheet" type="text/css" href="{$cssCombined}">
    </head>

No release at this moment. Try to create first one.

price-tag-2-line

Badges

guide-fill

Dependencies

php (>= 5.4.0)
nette/di (~2.4)
Componette Componette felix@nette.org