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
其他信息
- 授权协议: MIT
- 更新时间: 2013-10-16