2017 © Pedro Pelรกez
 

library php-compressor

PHP compressor merge multiple css and js files into one file

image

bvanhoekelen/php-compressor

PHP compressor merge multiple css and js files into one file

  • Wednesday, September 28, 2016
  • by Bart van Hoekelen
  • Repository
  • 1 Watchers
  • 4 Stars
  • 50 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 9 % Grown

The README.md

PHP compressor

Hex.pm Packagist Prerelease Packagist Github issues Travis branch Travis branch Build: Master|Develop, (*1)

php-compressor, (*2)

Highlight

  • Merge several files into one file
  • Live compiler, fast and no additional program is needed
  • Allows user to write code that can be used in other projects ยป Code reuse
  • The ability to set variables ยป see variable in help
  • Support .css, .fcss and .js files
  • Required no changes on the live server
  • Reducing server load and client load time
  • Optimizing assets for a higher rank in google search results ยป PageSpeed
  • Easy to install ยป instalation
  • Support for Laravel framework ยป Laravel

Workflow

  • Input, (*3)

    • Contains the building blocks
    • Folder can be placed before the public folder, no access for external users
    • For a better overview you can split easy your code in into several files
    • No @include, files are automatically merged
    • Ordering happened by name
  • Output, (*4)

    • Each extension has its own file
    • Use normal html tag <link href='compressor/take.css' rel='stylesheet'> and <script src='compressor/take.js'></script> to grab it
  • PHP compressor run (PhpCompressor::run()), (*5)

    • <loccation> (INPUT) directory where the .CSS, .FCSS and .JS files are
    • <destination> (OUTPUT) directory that contains the compressor/ folder. Note. de destination path is without the compressor/. This wil set in automatic
    • The output of PHP compressor wil set in the compressor/ folder as take.*
    • Run PHP compressor only in the developor environment, not in production!
    (Input)                                                           (Output)

Root/                                           .               Root/
โ””โ”€โ”€ Resources/             .. ..................;;.             โ””โ”€โ”€ Public/ (!)
    โ””โ”€โ”€ css/ (!)              .. PHP compresspr ;;;;.               โ””โ”€โ”€ compressor/ (static)
    โ”‚   โ”œโ”€โ”€ table.css    . . .::::::::::::::::::;;:'                   โ”œโ”€โ”€ take.css
    โ”‚   โ”œโ”€โ”€ alert.css                           :'                     โ””โ”€โ”€ take.js
    โ”‚   โ”œโ”€โ”€ button.css
    โ”‚   ...
    โ””โ”€โ”€ js/  (!)
    โ”‚   โ”œโ”€โ”€ table.js
    โ”‚   โ”œโ”€โ”€ alert.js
    โ”‚   โ”œโ”€โ”€ button.js
    โ”‚   ...
    ..

                             (PHP compressor)

 PhpCompressor::run(['resources/assets/css/', 'resources/assets/js/'], 'public/');
 PhpCompressor::run( [ <loccation> , <location>, ... ], <destination> ); // explanation!

Help, docs and links

Instalation

Install with Laravel

Get PHP compressor by running the composer command in the command line. ```{r, engine='bash', count_lines} $ composer require bvanhoekelen/php-compressor, (*6)


Open the `AppServiceProvider.php` located in `App\Providers\`. ```php // Add namespace at the top use PhpCompressor\PhpCompressor; // Place the code in the `public function boot()`. if(config('app.debug')) // DON'T USE ON PRODUCTION !! PhpCompressor::run(['resources/assets/css/', 'resources/assets/js/'], 'public/');

Place the code in <head> from the html file., (*7)

<!-- PHP compressor -->
<link href="{{ asset('/compressor/take.css') }}" rel="stylesheet">
<script src="{{ asset('/compressor/take.js') }}"></script>

Install with composer

Get PHP compressor by running the composer command in the command line. ```{r, engine='bash', count_lines} $ composer require bvanhoekelen/php-compressor, (*8)


Run PHP compressor by place code before the view is draw. ```php // Require vender autoload require_once('../vendor/autoload.php'); // Use namespace use PhpCompressor\PhpCompressor; // Switch which determines if environment is production $production = false; // Run php conpressor if( ! $production ) // DON'T USE ON PRODUCTION !! PhpCompressor::run(['resources/css/', 'resources/js/'], 'public/');

Place the code in <head> from the html file., (*9)

<!-- PHP compressor -->
<link href='compressor/take.css' rel='stylesheet'>
<script src='compressor/take.js'></script>

The Versions

28/09 2016

dev-master

9999999-dev

PHP compressor merge multiple css and js files into one file

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.4.0

 

The Development Requires

laravel file css php javascript js compressor php-compressor fcss fast css cascading style sheets style sheets fast-css.com

28/09 2016

dev-develop

dev-develop

PHP compressor merge multiple css and js files into one file

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.4.0

 

The Development Requires

laravel file css php javascript js compressor php-compressor fcss fast css cascading style sheets style sheets fast-css.com

28/09 2016

1.1.5

1.1.5.0

PHP compressor merge multiple css and js files into one file

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.4.0

 

The Development Requires

laravel file css php javascript js compressor php-compressor fcss fast css cascading style sheets style sheets fast-css.com

25/09 2016

1.1.4

1.1.4.0

PHP file compressor for css and js. Compress multiple files to one simple .css and .js file!

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.4.0

 

laravel file css php javascript js compressor php-compressor fcss fast css cascading style sheets style sheets fast-css.com