How can I add the "--watch" flag to this TextMate snippet?
Posted
by Jannis
on Stack Overflow
See other posts from Stack Overflow
or by Jannis
Published on 2009-10-18T22:35:23Z
Indexed on
2010/03/22
17:01 UTC
Read the original article
Hit count: 395
I love TextMate as my editor for all things web, and so I'd like to use a snippet to use it with style.less
files to automatically take advantage of the .less way of compiling .css files on the fly using the native
$ lessc {filepath} --watch
as suggested in the less documentation (link)
My (thanks to someone who wrote the LESS TM Bundle!) current TextMate snippet works well for writing the currently opened .less file to the .css file but I'd like to take advantage of the --watch
parameter so that every change to the .less file gets automatically compiled into the .css file.
This works well when using the Terminal command line for it, so I am sure it must be possible to use it in an adapted version of the current LESS Command for TextMate since that only invokes the command to compile the file.
So how do I add the --watch
flag to this command:?
#!/usr/bin/env ruby
file = STDIN.read[/lessc: ([^*]+\.less)/, 1] || ENV["TM_FILEPATH"]
system("lessc \"#{file}\"")
I assume it should be something like:
#!/usr/bin/env ruby
file = STDIN.read[/lessc: ([^*]+\.less)/, 1] || ENV["TM_FILEPATH"]
system("lessc \"#{file}\" --watch")
But doing so only crashes the TextMate.app.
Any ideas would be much appreciated.
Thanks for reading.
Jannis
© Stack Overflow or respective owner