在composer.phar更新之后,总是会删除来自Bundle位置的CSS / JS / Images [英] CSS/JS/Images from Bundle location will be always removed after composer.phar update

查看:93
本文介绍了在composer.phar更新之后,总是会删除来自Bundle位置的CSS / JS / Images的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我不明白的小问题。我有一些由Symfony命令生成的Bundle项目,它们在web / bundle / mypersonalbundle中创建了一个通用的bundle文件夹。好的,但是当我从composer.phar进行更新时,其中一个始终为空。而且只有一个!谢谢您的帮助!

I have a tiny problem that i don't understand. I have some Bundle project generated by Symfony command, and they create a generic bundle folder in web/bundle/mypersonalbundle. OK, but one of them always be empty when I do an update from composer.phar. And only One! Thanks for your help !

$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
 - Removing doctrine/cache (v1.2.0)
 - Installing doctrine/cache (v1.3.0)
Loading from cache
...

Installing assets using the hard copy option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for OS\MyPersonalBundleBundle into web/bundles/mypersonalbundle # <--- ?
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution

I可以更新FrameworkBundle和DistributionBundle,但是为什么是我的个人捆绑包?

I'm Ok with updating the FrameworkBundle and DistributionBundle, but Why my personalbundle ?

这是我的composer.json需要配置:

Here is my composer.json "require" configuration :

"require" : {
    "symfony/symfony" : "2.3.*",
    "symfony/swiftmailer-bundle" : "2.3.*",
    "friendsofsymfony/user-bundle" : "~2.0@dev",
    "doctrine/orm" : ">=2.2.3,<2.4-dev",
    "symfony/assetic-bundle" : "2.3.*",
    "incenteev/composer-parameter-handler" : "~2.0",
    "twig/extensions" : "1.0.*",
    "php" : ">=5.3.3",
    "sensio/generator-bundle" : "2.3.*",
    "symfony/monolog-bundle" : "2.3.*",
    "sensio/framework-extra-bundle" : "2.3.*",
    "doctrine/doctrine-bundle" : "1.2.*",
    "sensio/distribution-bundle" : "2.3.*"
},

我的personalBundle是像我在AppKernel.php中的其他捆绑包一样注册良好:

My personalBundle is well registered like my other bundles in AppKernel.php :

$bundles = array(
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new FOS\UserBundle\FOSUserBundle(),
        new My\PersonalBundleBundle\MyPersonalBundleBundle(),
        new My\PersonalBundle2Bundle\MyPersonalBundle2Bundle(),
        new My\PersonalBundle3Bundle\MyPersonalBundle3Bundle(),
);


推荐答案

您有MyPersonalBundle。
在此捆绑包中,您有一个Resources目录。
在此目录中,您可以创建一个名为 public的目录,然后将您的css,js,img文件放入其中。允许公共目录中的目录。
当您使用composer时,它将执行 php应用/控制台资产:安装命令。
此命令复制web / bundle / mypersonalbundle中公共目录的内容。

You have a MyPersonalBundle. In this Bundle, you have a Resources directory. In this directory, you can create a directory named "public" then put your css, js, img files in it. Directory in the public directory are allowed. When you will use composer, it will do the php app/console assets:install command. This command copy the content of the public directory in web/bundle/mypersonalbundle.

建议:使用composer.json中的extra选项来创建符号链接

Advice : use the extra option in composer.json to create a symlink instead of using the hard copy.

"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "symlink"
}

,命令将为 php应用程序/控制台资产:安装--symlink

这篇关于在composer.phar更新之后,总是会删除来自Bundle位置的CSS / JS / Images的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆