Skip to content

This is a fork of Carlo's haml-sass-file-watcher. I found this simple script useful for integrating an existing project or prototyping. Some added features are the option to watch sass or haml only and configuration for folder location and names.

Notifications You must be signed in to change notification settings

narkeeso/haml-sass-file-watcher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

What It Does

Keeps an eye on a specified folder, waiting for HAML/SASS file changes. When a file was changed, it's re-generated in #{watch_folder}/output/ or #{watch_folder}/css/.

Usage

ruby watcher.rb watch_folder

Example

Running ruby watcher.rb /Users/Lebowski/Code/my_project will watch both both /Users/Lebowski/Code/my_project/haml/ and /Users/Lebowski/Code/my_project/sass/. When a contained HAML or SASS file is touched/saved, a new HTML or CSS file with the same basename is generated and saved in either /Users/Lebowski/Code/my_project/output/ (HTML) or /Users/Lebowski/Code/my_project/css/.

Fragments / Includes

Using the custom %include tag in HAML files you can include other HTML files. Think "fragments".

Example:

%h1 test omg
%include{ :file => "my_fragment" }
%h2 test lol

This will fetch the #{watch_folder}/output/my_fragment.html file and replace the %include tag/placeholder with its contents.

<h1>
  test omg
</h1>

<!-- INCLUDE: my_fragment START -->
<p>
  Fragment content stuff.
</p>
<!-- INCLUDE: my_fragment END -->

<h2>
  test lol
</h2>

It's a rather simple implementation. Again, it works for me, which is all I needed.

Dependencies

HAML & SASS, for obvious reasons. Also Hpricot. All are available as gems. You know where to look.

License

This code is released under the WTFPL.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2004 Sam Hocevar
 14 rue de Plaisance, 75014 Paris, France
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.

About

This is a fork of Carlo's haml-sass-file-watcher. I found this simple script useful for integrating an existing project or prototyping. Some added features are the option to watch sass or haml only and configuration for folder location and names.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%