Comparing version
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var chokidar, err1, err2, error, error1, nwgui, nwwin, watcher, | ||
var chokidar, err1, err2, error, error1, ignore, ignored, nwgui, nwwin, watcher, | ||
hasProp = {}.hasOwnProperty; | ||
@@ -35,2 +35,7 @@ | ||
}); | ||
ignored = [/node_modules|npm-debug\.log|\.git|\.hg|\.svn/]; | ||
ignore = document.currentScript.dataset.ignore; | ||
if (ignore) { | ||
ignored.push(ignore); | ||
} | ||
try { | ||
@@ -49,3 +54,3 @@ chokidar = window.require("nw-dev/node_modules/chokidar/"); | ||
watcher = chokidar.watch(".", { | ||
ignored: /node_modules|npm-debug\.log|\.git|\.hg|\.svn/ | ||
ignored: ignored | ||
}); | ||
@@ -52,0 +57,0 @@ watcher.on("change", function(path) { |
{ | ||
"name": "nw-dev", | ||
"description": "A drop-in library for nw.js development", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"repository": { | ||
@@ -37,4 +37,4 @@ "type": "git", | ||
"dependencies": { | ||
"chokidar": "^0.12.5" | ||
"chokidar": "^1.4.3" | ||
} | ||
} |
# nw-dev | ||
A drop-in library for [nw.js](https://github.com/nwjs/nw.js) development | ||
A drop-in library for [nw.js][] development | ||
@@ -42,20 +42,26 @@ * Live-reloads upon save | ||
## my window annoyingly asserts focus when reloading | ||
## exclude some files from being watched | ||
(This can be especially annoying if your editor autosaves!) | ||
By default `node_modules`, `npm-debug.log`, `.git`, `.hg`, and `.svn` are ignored. | ||
You probably have your app set up to show itself once it finishes loading. | ||
You can ignore additional paths by adding a `data-ignore` attribute to the script: | ||
That's a good thing, but you're calling `win.show()`, | ||
inadvertently focusing the window. | ||
```html | ||
<script src="node_modules/nw-dev/lib/dev.js" data-ignore="data.json|*.md"></script> | ||
``` | ||
Do this (with CoffeeScript): | ||
The ignore pattern will be passed to [chokidar][] and interpreted by [micromatch][]. | ||
```coffee | ||
win.show() unless win.shown | ||
win.shown = yes | ||
``` | ||
Or this (with JavaScript): | ||
## don't annoyingly assert window focus when reloading | ||
(This can be especially annoying if your editor autosaves!) | ||
You may have your app set up to show itself once it finishes loading. | ||
That's a good thing, but if you're calling `win.show()`, | ||
it can inadvertently focus the window. | ||
Do this (with JavaScript): | ||
```js | ||
@@ -68,20 +74,22 @@ if(!win.shown){ | ||
(Now your autosaving workflow is once again beneficial!) | ||
Or this (with CoffeeScript): | ||
```coffee | ||
win.show() unless win.shown | ||
win.shown = yes | ||
``` | ||
(Now autosaving can once again be beneficial!) | ||
## develop nw-dev | ||
An ironically cumbersome workflow: | ||
* `npm i` | ||
* `npm link` | ||
* `npm link`, and `npm link nw-dev` from an nw.js project | ||
* `cd ~/some/other/project` | ||
* `npm link nw-dev` | ||
* `cd ../back/to/nw-dev` | ||
* `npm run prepublish` to recompile | ||
[nw.js]: https://github.com/nwjs/nw.js | ||
[chokidar]: https://github.com/paulmillr/chokidar | ||
[micromatch]: https://github.com/jonschlinkert/micromatch |
Sorry, the diff of this file is not supported yet
10655
6.93%111
4.72%94
9.3%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated