2017 © Pedro Peláez
 

library spassets

SlimPHP Assets Manager

image

bdwilliams/spassets

SlimPHP Assets Manager

  • Sunday, March 17, 2013
  • by bdwilliams
  • Repository
  • 2 Watchers
  • 5 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 8 % Grown

The README.md

Spassets - SlimPHP Asset Manager

TODO: * Twig Extension * Support for Less, (*1)

Example:

index.php:, (*2)

require 'vendor/autoload.php';

$assets = New \Spassets\Spassets();
$assets->minify = true;

$app->get('/', function () use ($app, $assets) {
    $css = $assets->printAssets('css', array('/css/bootstrap/bootstrap.min.css', '/css/bootstrap/bootstrap-responsive.min.css', '/css/custom.css'));
    $js = $assets->printAssets('js', array('/js/bootstrap/bootstrap.js', '/js/custom.js'));
    $app->render('index.html.twig', array('session' => $_SESSION, 'css' => $css, 'js' => $js));
});

index.html.twig:, (*3)

<!DOCTYPE html>
<html>
  <head>
    <title>Your Page</title>
    {{ css|raw }}
  </head>
  <body>
    <h1>Hello, world!</h1>
    {{ js|raw }}
  </body>
</html>

Recommended:

Gzip your assets by putting this in your root .htaccess file:, (*4)

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>

The Versions

17/03 2013

dev-master

9999999-dev https://github.com/bdwilliams/Spassets

SlimPHP Assets Manager

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

twig css javascript asset slim minify