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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀