dev-master
9999999-dev https://github.com/bdwilliams/SpassetsSlimPHP Assets Manager
MIT
The Requires
- php >=5.3.0
twig css javascript asset slim minify
Wallogit.com
2017 © Pedro Peláez
SlimPHP Assets Manager
TODO: * Twig Extension * Support for Less, (*1)
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>
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>
SlimPHP Assets Manager
MIT
twig css javascript asset slim minify