A new guard-nanoc (`nanoc watch` alternative)

655 views
Skip to first unread message

Denis Defreyne

unread,
Apr 6, 2013, 6:29:41 AM4/6/13
to na...@googlegroups.com
Hi all,

We’ve written a new guard-nanoc! Get it here: https://github.com/nanoc/guard-nanoc.



### What?

guard (https://github.com/guard/guard) is a framework for detecting filesystem changes and handling them. guard-nanoc is a plugin for guard that recompiles the nanoc site when the input has changed.

Guard-nanoc is very similar to nanoc watch, but has a few advantages:

* Easy to combine with other guard plugins
(See list at https://github.com/guard)
* Smaller code base, because most code is in the shared `guard` framework
* Support for a wide range of notifications
(See https://github.com/guard/guard#system-notifications)



### Installing

To install:

% git clone git://github.com/nanoc/guard-nanoc.git
% cd guard-nanoc
% gem build guard-nanoc.gemspec
% gem install guard-nanoc-*.gem

The installation procedure will be easier once the first actual version is released.

Please note that the `guard-nanoc` gem that can be installed using `gem install guard-nanoc` is *not* the official one! I aim to take over the old guard-nanoc project soon.



### Feedback

guard-nanoc is a very new project, but its goal is to replace the `watch` and `autocompile` commands. If you have any feedback, ranging from feature requests to bug reports, please do report them at https://github.com/nanoc/guard-nanoc/issues. Thanks!



Enjoy,

Denis

Tom Kenny

unread,
Apr 12, 2013, 12:39:54 AM4/12/13
to na...@googlegroups.com
I'm a big fan of this, notifications and the guard ecosystem would be excellent. Speaking of which, I've been trying to set up nanoc to work with guard-livereload and rack-livereload, so that you can use style injection easily, but I've had no luck yet given most information about it only references Rails or Sinatra. Have you tried this, by any chance?

Tom Kenny

unread,
Apr 15, 2013, 11:31:29 AM4/15/13
to na...@googlegroups.com
I've found a setup that lets you use LiveReload on any browser without extensions, using Serve and Rack; I'll make a new post for it as it's off-topic anyway and I think people would be interested in something like this.

On Monday, April 15, 2013 1:23:16 AM UTC+8, Nicolas wrote:
Livereload works OK.

It does not, for some reason, works on Chrome but is OK on Safari


Here is my Guardfile:

guard 'sass', :input => 'compass/sass', :output => 'content/stylesheet',:load_paths => Dir.glob(File.join(Gem.dir, "gems", "compass*", "frameworks/blueprint/stylesheets")) + Dir.glob(File.join(Gem.dir, "gems", "compass*", "frameworks/compass/stylesheets"))

guard :shell do
  watch /^formatting\/**/ do
    `./formatting/build.fsx`
  end
end

guard 'livereload',  :port => '35729' do
  watch(%r{output/.+\.(css|js|html)})
end

Tom Kenny

unread,
Apr 15, 2013, 12:04:41 PM4/15/13
to na...@googlegroups.com
Ah, shit. Well, it was working a couple days ago. Clues:

Strip out the unrelated stuff from https://github.com/bomberstudios/serve-livereload.

Get Serve, tell it to use Rack with this:
https://github.com/johnbintz/rack-livereload, which pumps livereload.js or a Flash fallback into the <head>. 

Then tell Guard to watch for changes in your content and send them to whatever live-reload connections it can find:


Tom Kenny

unread,
Apr 23, 2013, 11:42:49 PM4/23/13
to na...@googlegroups.com
I forked and simplified serve-livereload at https://github.com/twome/serve-livereload

On my machine, the first time guard-livereload connects it will work fine until the connection breaks (which happens every time the page refreshes). This rules out being able to use it for HTML or JS, which is obviously a huge deal.

Denis Defreyne

unread,
Apr 28, 2013, 6:46:19 AM4/28/13
to na...@googlegroups.com
Hi all,

I’ve taken over the official guard-nanoc project, which means that guard-nanoc can now be installed using Rubygems:

gem install guard-nanoc

So, please disregard the “Installation” section in the original mail.

Enjoy!

Denis

Tom Kenny

unread,
Apr 28, 2013, 7:42:08 AM4/28/13
to na...@googlegroups.com
Ah, brilliant!

Bill Burton

unread,
Apr 28, 2013, 11:35:10 AM4/28/13
to nanoc
Hello Denis,

That's good news!  Was able to successfully install updated version.  

Is the Git repo going to stay at https://github.com/nanoc/guard-nanoc or replace the one at https://github.com/guard/guard-nanoc?

In any case, the Guard Wiki at https://github.com/guard/guard/wiki/List-of-available-Guards should be updated to point to your version.

Thanks,
-Bill

Denis Defreyne

unread,
Apr 28, 2013, 2:14:08 PM4/28/13
to na...@googlegroups.com
Hi Bill,

The goal is to move the repository to https://github.com/guard/guard-nanoc. That should be completed this week!

I’ve updated the list of available guards! Thanks for pointing that out.

Denis
> --
> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "nanoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Denis Defreyne

unread,
May 1, 2013, 2:27:55 PM5/1/13
to na...@googlegroups.com
And done: https://github.com/guard/guard-nanoc ! :)

Denis
Reply all
Reply to author
Forward
0 new messages