dioscouri/f3-minify

F3框架的前端包管理器

安装次数: 1,185

依赖者: 1

建议者: 0

安全性: 0

星标: 0

关注者: 6

分支: 1

开放问题: 6

类型:组件

v0.9.0 2015-08-31 17:05 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:40:28 UTC


README

F3框架的前端包管理器

入门指南

Add this to your project's composer.json file:

{
    "require": {
        "dioscouri/f3-minify": "dev-master"
    }
}

用例

您希望有一个单一的访问点,用于所有应用中的CSS和JS,可以将它们注册以进行压缩,并通过路由返回

 // tell Minify where to find Media, CSS and JS files
        \Minify\Factory::registerPath($this->app->get('PATH_ROOT') . "public/Theme/");
        \Minify\Factory::registerPath($this->app->get('PATH_ROOT') . "public/Theme/css/");
        \Minify\Factory::registerPath($this->app->get('PATH_ROOT') . "public/");
        
        
        // add the media assets to be minified
        $files = array(
            'css/style.css'
        );
        
        foreach ($files as $file)
        {
            \Minify\Factory::css($file);
        }
        
        $files = array(
            'js/script.js'
        );
        
        foreach ($files as $file)
        {
            \Minify\Factory::js($file, array(
                'priority' => 1
            ));
        }