johnpitcher/public-vendor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

johnpitcher/public-vendor

Composer 安装命令:

composer require johnpitcher/public-vendor

包简介

Silex provider and grunt task for dealing with static assets in composer's vendor directory

README 文档

README

Silex provider define addittional routes whitch are resolved as vendor assets (this is only helpful when you don't want to have vendor folder in public directory). For example:

project
  app - application directory 
  vendor - composer libraries
    author
      package
        assets
          css
          js
            file.js
          img
  public - http root folder
    css
    js
    img

If you want to access to package assets using public-vendor provider use this url:

<script src="/vendor/author/package/assets/js/file.js"></script>

Setup provider

$app = Silex\Application();
$app->register(new PublicVendor\ServiceProvider());

Setup vendor path

Default vendor path is __DIR__.'../../../../' as it should be in composer's vendor folder.

$app['public-vendor']->setPath('new/path');

Setup aliases

Alias helps to remove one part of vendor name, for example: from author/package to package.

This configuration:

$app['public-vendor']->addAlias('author/package', 'package');

will make this path available:

<script src="/vendor/package/assets/js/file.js"></script>

Setup sub paths

Sub paths define directory in package where asset are stored. This configuration:

$app['public-vendor']->addSubPath('author/package', 'assets');

will make this path available:

<script src="/vendor/author/package/js/file.js"></script>

Grunt Task:

If you are using usemin task you can add publicVendor task before useminPrepare. It's important to setup gruntfile.js in the same directory as composer's vendor directory. For example:

project
  vendor
  public
  gruntfile.js

Setup task

grunt.loadTasks('vendor/johnpitcher/public-vendor/tasks')
grunt.initConfig({
  publicVendor: {
    options:{
      aliases: { 'package' : 'author/package' },
      subPaths: { 'author/package' : 'assets' },
      baseDir: 'vendor'
    }
  },
  useminPrepare: { ... }
);

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固