Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Hot-code pushes using the all-powerful Watchfile.
JavaScript CoffeeScript Other
tree: 50f89b49a3

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
example @ 24d1089
lib
src
test
wiki @ b86a0b2
.gitignore
.gitmodules
.npmignore
.rvmrc
Cakefile
MIT-LICENSE.md
README.md
Watchfile
design.io.js
package.json

README.md

Design.io

CSS3 + TextMate + Node.js = Real-Time Web Design

Video Tutorial

Here's a video tutorial on vimeo

Here is the example app for the video.

Install

npm install design.io -g
design.io start

Run

Then in your specific project watching files, run

design.io

To list all of the processes design.io is using, run

forever list

This is from the awesome forever module from Nodejitsu, which allows you to easily manage multiple child processes.

Extensions

Usage

Add the design.io.js client to your html head. You also need jQuery, and Socket.IO.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="/javascripts/socket.io.js"></script>
<script type="text/javascript" src="/javascripts/design.io.js"></script>

You can just grab socket.io from here as well.

Next, create a file named Watchfile at the root of your project, and start the watcher with this command:

design.io

If you want to install it locally and run the command, do this:

npm install design.io # no '-g' flag
node_modules/design.io/bin/design.io

The Watchfile

This is what a blank watch task looks like in a Watchfile:

# ./Watchfile

watch /\.(styl|less|sass|scss|css)$/
  create: (path) ->
    @update(path)

  update: (path) ->

  delete: (path) ->

  client:
    # id, path, body
    create: (data) ->
      # this is in the browser's context!

    update: (data) ->

    delete: (data) ->

You can update the Watchfile and the changes will be affected in real time by adding this extension:

# Watchfile

require('design.io').extension('watchfile')()

# ... more watchers

Using Extensions

Design.io comes with two basic extensions:

  1. Stylesheet watching/compressing/injecting
  2. JavaScript watching/compressing/injecting

You can include them in your Watchfile like this:

require("design.io").extension("watchfile")
require("design.io").extension("stylesheets", compress: true)
require("design.io").extension("javascripts")

watch /\.md$/ # some custom one...

Connecting with a Remote Server

designer = require("design.io").connection(app || 4181)

app.post '/design.io/:action', (request, response) ->
  designer.emit request.params.action, request.body
  response.send request.params.action

Possibilities

Resources

License

(The MIT License)

Copyright © 2011 Lance Pollard <lancejpollard@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.