1.1.9 • Published 8 years ago

watchalive v1.1.9

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Watchalive.

A small but robust dev server with smart file watching and transform support.

Generally:

  • http express server
  • lean and smart file watcher
  • socket.io server and client

Useful features:

  • watches only served (requested by client) files
  • transforms (transpiles/compiles) files on the fly using simple plugins
  • handles custom routes
  • proxies requests to other services
  • client gets notified about changes including changed sources

If you have question you may ping on gitter Gitter

Usage (CLI)

npm install watchalive -g

Place watchalive.config.js (or just watchalive.js or wa.config.js as you like) in your project folder. Run "watchalive" from command line.

Example configuration file (loading React.js transformed files with SystemJS loader):

"use strict"
var babel = require('babel-core')

module.exports = {
    base: "..", // base serve directory, relative to process.cwd()
    skip: [/node_modules/], // won't watch, cache and transpile     
    plugin: [
        ["less", {paths: ['client']}], // standard less/css plugin
        [/\.js$/, (source) => // custom transformer
              babel.transform(source, {
                  presets: ["es2015", 'react'],
                  plugins: [
                      ['react-transform', {
                          transforms: [
                              {transform: 'react-transform-jspm-hmr'}
                          ]
                      }]
                  ]
              }).code 
        ]
    ],
    // advanced routing
    route: [
        {'/mobile': '/client/mobile/index.html'},
        {'*': '/client/web/index.html'}
    ],
    // flexible proxy config
    proxy: {
        '/api': 'my-app.dev:2000'
    },
    data: true // send source of changed file with notification message 
}

You can also place config in package.json in "watchalive" section.

Also you can run without config file:

watchalive --port 7007 --base ..

API usage

npm install watchalive
"use strict"
const Watchalive = require('watchalive')
 
var wa = new Watchalive({/*config */})

wa.start()

Deep dive into options!

Client side usage

By default served *.html files get watchalive.js client script injected. You can easily access to this notifications in code:

    watchalive.onFiles(function(changes){
        // *changes* contain array of file names changed
        // can also contain changed file sources {file: ..., data: ...}
    })

Examples of usage

Licence

MIT

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.4.14

9 years ago

0.4.13

9 years ago

0.4.12

9 years ago

0.4.11

9 years ago

0.4.10

9 years ago

0.4.9

9 years ago

0.4.8

9 years ago

0.4.7

9 years ago

0.4.6

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.26

10 years ago

0.1.25

10 years ago

0.1.24

10 years ago

0.1.22

10 years ago

0.1.21

10 years ago

0.1.20

10 years ago

0.1.19

10 years ago

0.1.18

10 years ago

0.1.17

10 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago