

Sword - bradly
http://sword.mu/

======
philsnow
With a proper Makefile,

    
    
        $ cd project
        $ inotifywait -m -e modify,close_write,move,move_self,create,delete,delete_self -r . | while read; do make; done
    

Every time any source is modified, renamed, created, etc, that will run
'make', rebuilding whatever output artifacts you need.

As long as you're careful about always re-fetching artifacts (like css files
built from whatever css-sugar-y thing is hot this week) somehow, that should
set you up nicely, and it generalizes to all kinds of workflows.

~~~
jhh
Thanks for making me aware of this. This is linux specific but something like
this seems to be available on Mac OS X
([https://github.com/alandipert/fswatch](https://github.com/alandipert/fswatch)).

I don't quite understand where in your command you specify that make is
executed? Could you expand on that.

~~~
dota168
while read; do make; done

~~~
philsnow
that's spot on.

the command "inotifywait -m -r . -e {some events}" recursively watches all
inodes in the current directory (the "-r" and "." parts) for events in the
{some events} list, and every time something happens (you save a file, create
a new one, open a file, etc etc), inotifywait prints a line.

The "-m" flag makes it print a line and keep watching. Without that, it's a
one-shot (which can work like [0] but all the setting up and tearing down of
inotify watches is expensive on a large project).

[0]

    
    
        $ while inotifywait -e some,events -r . ; do make; done

------
sejje
I like it.

Not being familiar with .styl, though, this line confused me: "So, it has
found /assets/style.styl."

Especially because it found style.sass

~~~
zxide
.styl is the file extension for stylus. Its just another css preprocessor like
less or scss

[http://learnboost.github.io/stylus/](http://learnboost.github.io/stylus/)

I think this part is just a typo

> So, it has found /assets/style.styl. Now it analyzes extension:

>

> .sass extension? Use Sass then.

~~~
svoroval
Thank you, will fix it.

------
taylorlapeyre
Seems very similar to the Harp project:
[http://harpjs.com/](http://harpjs.com/)

I may actually prefer this better because of the scss/sass support, though.

~~~
dcu
Serve is also very similar: [http://get-serve.com/](http://get-serve.com/)

~~~
metabren
Could not recommend this more – strikes _just_ the right balance between a
Rails app and plain HTML/CSS for prototyping.

------
huhtenberg
I have no use for this, but it should really be caching compiled versions and
recompile resources only when they become newer than what's cached.

------
ggchappell
I think some information is missing here.

Suppose I want to look at a CSS file (zzz.css, say). But that file does not
exist, since I'm using LESS to make my CSS. The LESS source exists; the CSS
output does not -- yet. I'm using sword.

I have a Unix command prompt in front of me. What do I type?

~~~
theon144
How I understood it:

    
    
        $ sword &
        $ wget localhost:1111/path/to/style.css

------
bronbron
I don't really see the benefit over using something that does background
compilation e.g. CodeKit.

Also it seems a little silly/wasteful to use this in a production environment,
which I may be mistaken about but the last paragraph seems to be instructions
for deploying a site on top of this.

~~~
svoroval
It is silly and wasteful. It is just possible.

~~~
adambard
There seems to be no mention in the docs of where the compiled files end up,
if anywhere; taking the docs literally it appears that this is the preferred
way to use sword, which is indeed silly and wasteful.

~~~
svoroval
Just use --compile flag. Here is the issue:
[https://github.com/somu/sword/issues/7](https://github.com/somu/sword/issues/7)

------
ethanliu
If you prefer GUI and reload the browser for you, I think livereload does very
well.

[http://livereload.com](http://livereload.com)

------
etjossem
What's the advantage of using Sword over, say, compass watch?

~~~
svoroval
Zero configuration (no config.rb), a lot of preprocessors besides Sass/Compass
supported (like LESS, HAML, Slim, CoffeeScript and so on).

------
th0br0
Sounds neat! An easy-to-use (API) proxy would be a killer feature.

~~~
svoroval
Got it! Open an issue and describe your thoughts? Will think to add it in the
next release.

------
steele
is this similar to yeoman?

~~~
svoroval
Not really.

------
devgutt
$ watch

------
straykov
Like!

