dpi10335 2015-05-27 16:24
浏览 31
已采纳

在symfony2中反向设计css和js文件

In symfony2 there are compiled and uncompiled css/js files i did not knew that. So we made changes to file directly under web/css and web/js folder. Now i am having trouble as to how to move the files to uncompiled files that is files under asset folders.

So i cannot run this command now: php app/console assetic:dump --env=prod --no-debug which will re-create all css and js files under web folder and we will loose all our changes.

Is there any command or way to reverse this? Like move our changes from web/css or web/js folder to assets with one go rather than hand picking them?

  • 写回答

1条回答 默认 最新

  • douhuang2282 2015-05-29 21:25
    关注

    A way to do it would be to backup your web/css and web/js folders, then run php app/console assetic:dump --env=prod --no-debug again.

    This way, you will have the version with changes (in the back-up) and without in web/css and web/js.

    Then via a diff command on your server, you would be able to spot the changes you have to move manually back to the assets.

    If you are on a production site and really need this operation to go quickly you can do this :
    The first four commands are just to have a back up of the actual state. Then the rest is to recreate the assets as they should be and save those in a folder to compare them later on then reinstate the back up where your manual changes are so the people browsing your site won't hopefully have the time to notice anything.

    cd web
    cp -R js js.bk
    cp -R css css.bk
    cd .. 
    php app/console assetic:dump --env=prod --no-debug && cd web && cp -R js js.clean && cp -R css css.clean && rm -R css && cp -R css.bk css && rm -R js && cp -R js.bk js
    

    Then you can compare the folders .bk against le folders .clean

    diff css.clean css.bk
    diff js.clean js.bk
    

    And readjust your changes on the right assets

    A dummy example of a diff result :

    bash$ diff a b
    diff a/test.css b/test.css
    1c1
    < .a { color:#321; }
    ---
    > .a { color:#123; }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用