Design.io can't hot-push code

半腔热情 提交于 2019-12-11 19:47:02

问题


Trying to use design.io with node.js Express to get css/javascript hot-push into browsers, I cloned the example https://github.com/viatropos/design.io-example and couldn't get it to hot deploy after

  1. following instructions in https://github.com/viatropos/design.io-example/README.md

    shell-1-project-dir> design.io --watch ./src

    error: unknown option `--watch'

  2. following the instruction on https://github.com/viatropos/design.io/README.md

    shell-1-project-dir> design.io start

    shell-2-project-dir> design.io watch

    [Sun, 06 May 2012 03:52:04 GMT] INFO updated views/.index.jade.swp

    [Sun, 06 May 2012 03:52:04 GMT] INFO updated views/index.jade

    [Sun, 06 May 2012 04:03:11 GMT] INFO updated views/.index.jade.swp

    [Sun, 06 May 2012 04:03:11 GMT] INFO updated views/index.jade

    Doing this, I can't access the http://localhost:4181/ because node.js isn't started. I have to start node.js instead.

    shell-1-project-dir> node server.js

    However this doesn't hot-push the changed index.jade file.

Seems like the example is outdated?

How do I hot deploy ?

Env:

 OSX-LION
 node 0.6.15

回答1:


First, you can have your node server running in a different terminal window (you don't need to run either the design.io server or the node server, you can run both at the same time as long as they are on different ports).

Second, I don't think this does what you want it to. Design.io seems to be for injecting changes made to static client files like stylesheets and javascript files. You change a .css file, design.io sees the change and broadcasts it to the browser, design.io in the browser forces a stylesheet reload, completing the hot push of the change.

Jade files are a different story, they need to be processed by an interpreter before being sent to the browser (browsers don't understand jade files). Design.io will see the change but can't do anything about it since Node.js needs to process the new file and send an updated response to the browser. The only way it does this is if you refresh the browser page (thereby sending a new request) which is not really a hot swap.



来源:https://stackoverflow.com/questions/10468021/design-io-cant-hot-push-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!