sass --watch 进程正在锁定我的终端窗口 [英] sass --watch process is locking up my terminal window

查看:21
本文介绍了sass --watch 进程正在锁定我的终端窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 shell 脚本来优化我在网络/前端项目上的构建过程.

I'm working on a shell script to optimize my build process on a web/front end project.

我正在使用 sass 来增强 css 开发,并使用 html5boilerplate 构建脚本来优化开发.

I'm using sass to enhance css development and the html5boilerplate build script to optimize for development.

我正在尝试让脚本执行以下操作.1.检查sass --watch是否开启,如果没有运行

I'm trying to get the script to do the following. 1. check if sass --watch is enabled, if not run

sass --watch file.scss:file.css

2.cd 进入 build 文件夹并运行 ant build

2. cd into the build folder and run ant build

问题是 sass --watch 会锁定终端,并且在我按下 Control-C 停止 sass 之前,脚本不会进入 ant 构建.

The problem is that sass --watch locks up the terminal and the script won't step into the ant build until I hit Control-C to stop sass.

我已经尝试使用xterm"为 sass 生成一个新的终端窗口,但是 xterm 在我的 mac 上打开 X-11 应用程序并且没有任何触发.

I've tried 'xterm' to spawn a new terminal window for sass, but xterm opens the X-11 app on my mac and nothing fires.

还有其他打开终端窗口的方法吗?有没有办法线程sass?我真的很想运行我的脚本并返回到命令提示符,这样我就可以整天重复我的命令并保持构建过程顺利运行.

Is there another way to open a terminal window? Is there a way to thread sass? I really want to run my script and get back to a command prompt so I can repeat my command all day and keep the build process running smoothly.

推荐答案

这是在 Unix/Linux 环境下吗?然后尝试通过附加&"在后台运行您的 sass 命令(后台运行)字符.即

This is under a Unix/Linux environment? Then try running your sass command in the background by appending the '&' (run-in-background) char. I.E.

sass --watch file.scss:file.css &

编辑 - 扩展监控的可能性

下一个级别是使其独立于它的开始位置.

The next level would be to make this independent of where it is started.

nohup sass --watch file.scss:file.css > ${logDir}/$(/bin/date +%Y%m%d.%H%M).sass_watch.log 2>&1 &

您可以启动 sass --watch 并关闭窗口,它会继续运行.稍后,如果您需要查看进度,可以使用

You can start sass --watch and close the window, it will keep running. Later on, if you need to check progress, you can use

tail -f ${logDir}/$(/bin/date +%Y%m%d.%H%M).sass_watch.log

观看当前活动.

如果您怀疑不久前发生了某些事情,您可以指定要包含在回滚"中的行数,即

If you suspect something happened a while back, you can specify the # of lines to include in the 'scroll back', i.e.

tail -1000 -f ${logDir}/$(/bin/date +%Y%m%d.%H%M).sass_watch.log

最后,如果您的 sass --watch 支持某种时间带(例如,在运行 24 小时后停止),您可以创建一个 crontab 条目,以便您始终运行 --watch 并且您始终可以显示您的经理究竟是什么/什么时候系统发现的.

Finally, you if your sass --watch supports some sort of time banding (stop after running 24 hrs, for example), you could make a crontab entry so you always have the --watch running AND you can always show your manager exactly what/when the system found.

编辑 crontab,添加条目

edit crontab, add entry

01 00 * * * { sass --watch --time 24hrs file.scss:file.css ; } > ${logDir}/$(/bin/date +%Y%m%d.%H%M).sass_watch.log 2>&1 

Crontabs 有点棘手.如果您觉得可以使用它们,最好阅读手册页和其他在线帮助,如果遇到困难,请在 http://unix.stackexchange.com 获取帮助.

Crontabs are a little tricky. If you get to the point you feel you can use them, better to read the man page, other on-line help, and if you get stuck, then post on http://unix.stackexchange.com to get help.

我希望这会有所帮助.

这篇关于sass --watch 进程正在锁定我的终端窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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