Overview

Namespaces

  • GAubry
    • ErrorHandler
    • Helpers
    • Logger
    • Shell
  • Himedia
    • Padocc
      • DB
      • Minifier
      • Numbering
      • Properties
      • Task
        • Base
        • Extended
  • None
  • Psr
    • Log

Classes

  • Factory
  • JSMinAdapter

Interfaces

  • MinifierInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Class JSMinAdapter

Compresser les fichiers JS et CSS.

Himedia\Padocc\Minifier\JSMinAdapter implements Himedia\Padocc\Minifier\MinifierInterface
Namespace: Himedia\Padocc\Minifier
Author: Geoffroy AUBRY <gaubry@hi-media.com>
Located at Himedia/Padocc/Minifier/JSMinAdapter.php
Methods summary
public
# __construct( string $sJSMinBinPath, GAubry\Shell\ShellAdapter $oShell )

Constructeur.

Constructeur.

Parameters

$sJSMinBinPath
string
$sJSMinBinPath chemin du binaire JSMin
$oShell
GAubry\Shell\ShellAdapter
$oShell instance utilisée pour exécuter le binaire jsmin
public Himedia\Padocc\Minifier\MinifierInterface
# minify( array $aSrcPaths, string $sDestPath )

Minifie la liste de fichiers JS ou CSS spécifiée et enregistre le résultat dans $sDestPath.

Minifie la liste de fichiers JS ou CSS spécifiée et enregistre le résultat dans $sDestPath.

Parameters

$aSrcPaths
array
$aSrcPaths liste de fichiers se finissant tous par '.js', ou tous par '.css'
$sDestPath
string
$sDestPath chemin/fichier dans lequel enregistrer le résultat du minify

Returns

Himedia\Padocc\Minifier\MinifierInterface
$this

Throws

BadMethodCallException
si $aSrcPaths vide
UnexpectedValueException
si les sources n'ont pas toutes la même extension de fichier
UnexpectedValueException
si la destination est un CSS quand les sources sont des JS ou inversement
DomainException
si des fichiers ne se terminent ni par '.js', ni par '.css'

Implementation of

Himedia\Padocc\Minifier\MinifierInterface::minify()
protected
# minifyJS( array $aSrcPaths, string $sDestPath )

Minifie la liste des fichiers JS spécifiée et enregistre le résultat dans $sDestPath.

Minifie la liste des fichiers JS spécifiée et enregistre le résultat dans $sDestPath.

Parameters

$aSrcPaths
array
$aSrcPaths liste de fichiers se finissant tous par '.js'
$sDestPath
string
$sDestPath chemin/fichier dans lequel enregistrer le résultat du minify

Throws

RuntimeException
en cas d'erreur shell
protected
# minifyCSS( array $aSrcPaths, string $sDestPath )

Minifie la liste des fichiers CSS spécifiée et enregistre le résultat dans $sDestPath.

Minifie la liste des fichiers CSS spécifiée et enregistre le résultat dans $sDestPath.

Parameters

$aSrcPaths
array
$aSrcPaths liste de fichiers se finissant tous par '.css'
$sDestPath
string
$sDestPath chemin/fichier dans lequel enregistrer le résultat du minify

Throws

RuntimeException
si l'un des fichiers est introuvable
private string
# getHeader( array $aSrcPaths )

Retourne une ligne de commentaire, à insérer en 1re ligne d'un fichier CSS ou JS minifié, énumérant tous les fichiers sources le constituant.

Retourne une ligne de commentaire, à insérer en 1re ligne d'un fichier CSS ou JS minifié, énumérant tous les fichiers sources le constituant.

Par exemple : "/* Contains: /home/resources/a.css [slash]\n" "/ Contains (basedir='/path/to/resources/'): a.txt, b.txt *[slash]\n"

Parameters

$aSrcPaths
array
$aSrcPaths liste de fichiers sources

Returns

string
une ligne de commentaire, à insérer en 1re ligne d'un fichier CSS ou JS minifié, énumérant tous les fichiers sources le constituant.
private string
# getLargestCommonPrefix( array $aStrings )

Retourne le plus long préfixe commun aux chaînes fournies.

Retourne le plus long préfixe commun aux chaînes fournies.

Parameters

$aStrings
array
$aStrings liste de chaînes à comparer

Returns

string
le plus long préfixe commun aux chaînes fournies.

See

http://stackoverflow.com/questions/1336207/finding-common-prefix-of-array-of-strings/1336357#1336357
private string
# getContent( array $aSrcPaths )

Retourne la concaténation du contenu des fichiers spécifiés.

Retourne la concaténation du contenu des fichiers spécifiés.

Parameters

$aSrcPaths
array
$aSrcPaths liste de chemins dont on veut concaténer le contenu

Returns

string
la concaténation du contenu des fichiers spécifiés.

Throws

RuntimeException
si l'un des fichiers est introuvable

See

Himedia\Padocc\Minifier\JSMinAdapter::minifyCSS()
Properties summary
private GAubry\Shell\ShellAdapter $oShell
#

Shell adapter.

Shell adapter.

See

Himedia\Padocc\Minifier\JSMinAdapter::minifyJS()
private string $sBinPath
#

Chemin du binaire JSMin

Chemin du binaire JSMin

See

Himedia\Padocc\Minifier\JSMinAdapter::minifyJS()
Platform for Automatized Deployments with pOwerful Concise Configuration API documentation generated by ApiGen 2.8.0