2017 © Pedro Peláez
 

library assets-manager

image

serebro/assets-manager

  • Saturday, February 14, 2015
  • by Serebro
  • Repository
  • 1 Watchers
  • 0 Stars
  • 68 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Assets manager

It can work with "rev-manifest.json" file of gulp-rev plugin., (*1)

$env = 'prod';
$revisionMap = json_decode(file_get_contents('build/manifest.json'), true); // { "file1.js": "file2-73a4818b.min.js", "file2.js": "file2-54e1080b.min.js" }

$ar = new \Serebro\Assets\Revision($env);
$ar->setRevisionMap($revisionMap)->setPrefix('http://cdn.example.com');


$assetsManager = \Serebro\Assets\Manager::getInstance();
$assetsManager
    ->setRevisionManager($ar)
    ->collection('head')
    ->addCss('main.css')
    ->addJs('file1.js')
    ->collection('body')
    ->addCss('special.css')
    ->addJs('file2.js');

echo $assetsManager->outputCss('head') . PHP_EOL;
echo $assetsManager->outputJs('head') . PHP_EOL;
echo $assetsManager->outputCss('body') . PHP_EOL;
echo $assetsManager->outputJs('body') . PHP_EOL;

Result:

<link rel="stylesheet" href="http://cdn.example.com/css/main.css"/>
<script type="text/javascript" src="http://cdn.example.com/js/file1-73a4818b.min.js"></script>
<link rel="stylesheet" href="http://cdn.example.com/css/special.css"/>
<script type="text/javascript" src="http://cdn.example.com/js/file2-54e1080b.min.js"></script>

The Versions

14/02 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

14/02 2015

1.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires