【发布时间】:2013-07-17 04:12:48
【问题描述】:
我刚刚构建了 Nodejs 并安装了 0.10.6 然后卸载了 yo+grunt-cli+bower+generator-webapp 并使用 npm -g 重新安装到最新版本,
哟 webapp
但是现在实时重新加载不起作用,在 chrome devtools 中也看不到任何错误
哟-v:1.0beta5
grunt-cli v0.1.8 和 grunt v0.4.1
凉亭-v:0.9.2
节点-v:0.10.6
npm -v: 1.2.18
grunt 服务器显示 watch 任务:时间 + 文件名已更改
尝试过:将 Gruntfile 中的端口号更改为.. LIVERELOAD_PORT = 34729;诺戈 :(
我较旧的 webapp 项目仍然可以正常工作
丢了..
谢谢
--------------------- 更新
1. 将 lrSnippet 移至 Grunfile.js 中的第 1 位
2. 在 index.js 中移动
end.call(res, res.data, encoding);
在 if 块之外
现在它可以部分工作了:
总结:
1. 更改 index.html > 重新加载 ok
2. 更改 main.scss > 重新加载 ok
3. 更改 my.sass > 不行
第三步之后
1. 修改 index.html > 不行
2. 对 main.scss 的更改 > 不行
4. 对 hello.coffe 的更改 > 不行
第 4 步之后
1. 修改 index.html > ok
2. 修改 main.scss > ok
//---------------------------------------- index.html
对 index.html 的更改
重新加载确定
grunt 服务器窗口记录更改并发出重新加载命令
grunt 服务器窗口抓取 =
Running "watch" task
Waiting...OK
>> File "app/index.html" changed.
Running "watch" task
... Reload app/index.html ...
Completed in 0.002s at Sat May 18 2013 12:47:58 GMT+0530 (IST) - Waiting...
//---------------------------------------- main.scss
对 main.scss 的更改
重新加载确定
grunt 服务器窗口抓取 =
>> File "app/styles/main.scss" changed.
Running "compass:server" (compass) task
overwrite .tmp/styles/main.css
unchanged app/styles/my.sass
Running "watch" task
Completed in 1.906s at Sat May 18 2013 12:48:24 GMT+0530 (IST) - Waiting...
OK
>> File ".tmp/styles/main.css" changed.
Running "watch" task
... Reload .tmp/styles/main.css ...
Completed in 0.002s at Sat May 18 2013 12:48:24 GMT+0530 (IST) - Waiting...
//---------------------------------------- my.sass
更改 my.sass
重新加载不正常(不重新加载)
grunt 服务器窗口抓取 =
Running "watch" task
Waiting...OK
>> File "app/styles/my.sass" changed.
Running "compass:server" (compass) task
unchanged app/styles/main.scss
unchanged .tmp/images/generated/design-s65ab268e46.png
overwrite .tmp/styles/my.css
Running "watch" task
Completed in 0.602s at Sat May 18 2013 13:00:19 GMT+0530 (IST) - Waiting...
//----------------------------------------
my.sass 更改后
对 index.html 或 main.scss r 所做的更改未显示在 grunt 服务器窗口中
Watch 命令不记录任何内容。
更改 r 未重新加载
//--------------------------------------
重新启动的 Grunt 服务器
//---------------------------------------------------- hello.coffee
grunt 服务器窗口抓取 =
OK
>> File "app/scripts/hello.coffee" changed.
Running "coffee:dist" (coffee) task
File .tmp/scripts/hello.js created.
Running "watch" task
Completed in 0.011s at Sat May 18 2013 13:34:56 GMT+0530 (IST) - Waiting...
//----------------------------------------
【问题讨论】:
-
再次尝试了你的 webapp .. nogo .. 部分工作.. 详情见上文 ├── connect-livereload@0.1.4 ├─┬ grunt-contrib-connect@0.2.0 │ └─ ┬ connect@2.7.9 ├─┬ grunt-contrib-compass@0.2.0 ├─┬ grunt-contrib-watch@0.4.3