https://github.com/caseywebdev/guard-mirror
A CoffeeScript, Stylus, and Jade (HTML and JST) Guard that mirrors your source files (.coffee/.styl/.jst.jade/.html.jade) in another location (public/www/etc...).
https://github.com/caseywebdev/guard-mirror
Last synced: 3 months ago
JSON representation
A CoffeeScript, Stylus, and Jade (HTML and JST) Guard that mirrors your source files (.coffee/.styl/.jst.jade/.html.jade) in another location (public/www/etc...).
- Host: GitHub
- URL: https://github.com/caseywebdev/guard-mirror
- Owner: caseywebdev
- License: mit
- Created: 2012-06-07T15:51:24.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-03-09T21:13:08.000Z (almost 11 years ago)
- Last Synced: 2025-07-27T21:05:35.322Z (5 months ago)
- Language: Ruby
- Homepage:
- Size: 114 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
guard-mirror
============
A CoffeeScript, Stylus, and Jade (HTML and JST) Guard that mirrors your source
files (.coffee/.styl/.jst.jade/.html.jade) in another location
(public/www/etc...). guard-mirror also can compress the files on the fly for
use in production with a simple `compress: true` option. Google Closure
Compiler is used for JS and YUI Compressor for CSS. Jade -> HTML files are
automatically shrinkwrapped. Sprockets is used for file requiring and
concatination so all of the same Sprockets syntax can be used.
I created this to help with PhoneGap/Cordova development and it's working out really nice!
Installation
------------
In your `Gemfile`...
```ruby
source :rubygems
gem 'guard-mirror'
# Optionally a notifier like Growl. Syntax/parse errors will be displayed in
# notifications which becomes very handy!
# Use the `notify: false` option to turn this off
# gem 'growl'
```
If you want to use nib, you'll have to have the module installed. I recommend adding a `package.json` file to your root directory with something like...
```json
{
"name": "app-name",
"version": "0.0.1",
"author": "Your Name ",
"dependencies": [
"coffee-script",
"stylus",
"nib",
"jade"
]
}
```
And then running...
```bash
cd to/your/root
npm install
```
Configuration
-------------
In your `Guardfile`...
```ruby
guard :mirror,
paths: ['src/js/templates', 'src/js'],
# If a target is specified, only this file will be compiled when any
# watched file changes.
target: 'app.coffee',
dest: 'www',
compress: true do
watch %r{^src/js/(.+\..+)}
end
guard :mirror,
paths: ['src/css'],
target: 'app.styl',
dest: 'www',
# nib is supported with this flag
nib: true,
compress: true do
watch %r{^src/css/(.+\..+)}
end
guard :mirror,
paths: ['src/html'],
dest: 'www' do
watch(%r{^src/html/(.+\..+)}) { |m| m[1] }
end
```
Running It
----------
```bash
bundle update
bundle --binstubs
bin/guard
```
Profit!