定制 libra/libra-assets-installer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

libra/libra-assets-installer

Composer 安装命令:

composer require libra/libra-assets-installer

包简介

Makes accessible vendor assets (js, css, images) by creating/updating symlink to public/vendor/vendor-name folder

README 文档

README

##Description This package will help you to develop your vendor package with comfortable structure of public assets in public directory at root folder of your package. It will create symlink to this folder in public/vendor/vendor-name/package-name. So file public/css/screen.css will be accessible in view by:

$this->basePath() . '/vendor/vendor-name/package-name/css/screen.css';

At version 2.0.0 was changed logic of installing to use custom installer and rely on package type.

  • If your package is some assets like jquery, jquery-ui or twitter-bootsrap etc., you should set up type of package to asset. Then add to require list this package like

    {
        "name":         "vendor-name/asset-package-name",
        "type":         "asset"
        "require": {
            "libra/libra-assets-installer":     "~2.0"
        }
    }
    

    After installing assets will be in public/vendor/vendor-name/asset-package-name.

  • If you create standard ZF2 module that contains public assets into public directory
    then use "type": "asset-aware":

    {
        "name":         "vendor-name/package-with-assets-name",
        "type":         "asset-aware"
        "require": {
            "libra/libra-assets-installer":     "~2.0"
        }
    }
    

    Then contents of package-with-assets-name/public folder will be symlinked or on failure copied to public/vendor/vendor-name/package-with-assets-name

So URL will be the same in both cases.

##Options There available options (in format "type default"):

  • public-dir (only in root package)
    • if you wish put asset into another folder - put its name above
  • package-asset-dir (not available for type = asset)
    • if your asset dir has another name - put it above
  • add-target-dir: bool false/true (may be suitable for symfony bundles)
    • if enabled add target dir path to public asset path
    • Since v3.0 always true, DEPRECATED.

Some example:

    "extra": {
        "package-asset-dir": "assets"
    }

In root package:

    {
        "config": {
            "public-dir": "httdocs",
        }
    }

Note! For Zend Framework 2 modules it don't need to set up any configurations as usually.

##Instructions for ver. 1.* Despite of its working even in version 2.* you should'n rely on it feature in late version. This feature can be removed in any time in higher version but will be present in ver. 1.. I encourage to use ver, 2..

Note : For working this module you should set it first in required list in composer.json. Also supports Windows Vista/Windows Server 2008 or greater by php documentation. But really tested only under Linux. It uses symlink function hence behaviour at Windows unknown for me.

###Using: In root composer.json add this packages to required list as first item. Add this lines in root composer:

    "scripts": {
        "post-package-install":  "LibraAssetsInstaller\\Installer::postPackageInstall",
        "pre-package-uninstall": "LibraAssetsInstaller\\Installer::prePackageUninstall",
        "post-package-update":   "LibraAssetsInstaller\\Installer::postPackageUpdate"
    }

At first It was created for Libra CMS.

统计信息

  • 总下载量: 3.57k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2012-09-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固