Skip to content

Commit c7868e1

Browse files
authored
Adding webpack to make this project consumable in modern web frameworks (brownhci#142)
* Adding webpack to make this project consumable in modern web frameworks * add utils and dist folder to use it in examples * enable video preview flag * ensure project build successfully before code commit * Add licence, src-maps, cleanup * include tfjs union package, support es-modules. * remove source maps * exclude generated files from repo
1 parent e182326 commit c7868e1

33 files changed

+7100
-49432
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ node_modules/
3131
www/node_modules/
3232
build/webgazer.js
3333
build/webgazer.min.js
34+
.idea/
35+
dist/
36+
dist2/

Gruntfile.js

Lines changed: 0 additions & 92 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,31 @@ WebGazer.js is an eye tracking library that uses common webcams to infer the eye
2020
If you want to build the repository from source follow these instructions:
2121

2222
# Ensure NodeJS is downloaded: https://nodejs.org/en/download/
23-
# Install grunt-cli if not installed (this may require you to use `sudo` or run the console as Administrator)
24-
npm install -g grunt-cli
2523
git clone https://github.com/brownhci/WebGazer.git
2624
cd WebGazer
25+
#install the dependencies
2726
npm install
28-
# Run grunt to build the webgazer.js and webgazer.min.js file in the build directory
29-
grunt
27+
#build the project
28+
npm run build
3029

3130
<!-- To use the webgazer script in the head of an HTML file add the `async` tag to ensure the clmtrackr does not collapse to a slower version -->
3231

3332
## Examples
3433

3534
Examples of how WebGazer.js works can be found [here](https://webgazer.cs.brown.edu/#examples).
3635

36+
### to use in any modern framework
37+
38+
````
39+
const webgazer = require('webgazer.js'); // npm package 'webgazer.js' is sync with this repository
40+
````
41+
42+
or you can you do
43+
44+
````
45+
import webgazer from 'webgazer.js'
46+
````
47+
3748
### How to run the Example HTML files
3849

3950
Within the /www directory there are two example HTML files:

build/ridgeWorker.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
console.log('thread starting');
3-
//importScripts('../src/util.js', '../src/mat.js');
4-
@import "src/mat.js"
3+
importScripts('../src/worker_scripts/util.js', '../src/worker_scripts/mat.js');
54
var ridgeParameter = Math.pow(10,-5);
65
var resizeWidth = 10;
76
var resizeHeight = 6;

0 commit comments

Comments
 (0)