atom-package-reloader
reloades your atom packages on file change
Install
npm install --save-dev atom-package-reloader
Usage
returns a Function({pkg,folders})
if atom.inDevMode()
options | Type | Usage |
---|
pkg | string | name of your package |
folders | array | (optional) names of folders to watch defaults to '["lib"]' |
returns a object with three functions
function | Usage |
---|
reload() | manually reloads your package |
watchOnce() | renews folder watchers |
dispose() | manually dispose folder watchers |
watchOnce
will be called automatically.
One file change reload()
and dispose()
will be called.
if not atom.inDevMode()
null
will be returned
Example
Will only work in dev mode!
# inside of your activation function
# delay is necessary to eliminate double execution
# try-catch is only necessary if you use it as a dev-dependecy
setTimeout (->
reloaderSettings = pkg:"name-of-your-package",folders:["lib","styles"]
try
reloader ?= require("atom-package-reloader")(reloaderSettings)
catch
),500
# inside of your deactivation function
reloader?.dispose()
reloader = null
Release History
License
Copyright (c) 2015 Paul Pflugradt
Licensed under the MIT license.