Skip to content

Commit

Permalink
use webpack for build
Browse files Browse the repository at this point in the history
  • Loading branch information
yofreke committed Sep 12, 2016
1 parent 90b79c1 commit 2bcfb0a
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/clm_video.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<body>
<script src="./ext_js/utils.js"></script>
<script src="../models/model_pca_20_svm.js"></script>
<script src="../clmtrackr.min.js"></script>
<script src="../clmtrackr.js"></script>
<script src="../node_modules/stats.js/src/Stats.js"></script>
<div id="content">
<h2>Facetracking example</h2>
Expand Down
2 changes: 1 addition & 1 deletion examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body>
<script src="./ext_js/utils.js"></script>
<script src="../clmtrackr.min.js"></script>
<script src="../clmtrackr.js"></script>
<script src="../models/model_pca_20_svm.js"></script>
<div id="content">
<h2>Example</h2>
Expand Down
2 changes: 1 addition & 1 deletion examples/face_deformation_video.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<script src="../node_modules/exdat/build/dat.gui.min.js"></script>
<script src="./ext_js/utils.js"></script>
<script src="../models/model_pca_20_svm.js"></script>
<script src="../clmtrackr.min.js"></script>
<script src="../clmtrackr.js"></script>
<script src="../node_modules/stats.js/src/Stats.js"></script>
<script src="./ext_js/face_deformer.js"></script>
<div id="content">
Expand Down
2 changes: 1 addition & 1 deletion examples/face_mask.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<body>
<script src="./ext_js/utils.js"></script>
<script src="../models/model_pca_20_svm.js"></script>
<script src="../clmtrackr.min.js"></script>
<script src="../clmtrackr.js"></script>
<script src="../node_modules/stats.js/src/Stats.js"></script>
<script src="./ext_js/face_deformer.js"></script>
<div id="content">
Expand Down
5 changes: 2 additions & 3 deletions js/jsfeat_detect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// simple wrapper for jsfeat face detector
var jsfeat = require('jsfeat');
var findFaceWorker = require('./jsfeat_detect_worker');
var findFaceWorker = require('./jsfeat_detect_worker.js');

// Curtousy of stackoverflow this function
Worker.createURL = function(func_or_string){
Expand All @@ -22,7 +21,7 @@ var frontalface = require('./filters/frontalface.json');

var jsfeat_face = function(image) {

var img_u8,work_canvas,work_ctx,ii_sum,ii_sqsum,ii_tilted,edg;
var work_canvas, work_ctx;

var w = image.width;
var h = image.height;
Expand Down
5 changes: 4 additions & 1 deletion js/jsfeat_detect_worker.js

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
"version": "0.0.1",
"description": "Javascript library for precise tracking of facial features via Constrained Local Models",
"scripts": {
"build": "browserify js/index.js -s clm -o ./clmtrackr.js; uglifyjs ./clmtrackr.js -m -r 'clm,clmtrackr' -o ./clmtrackr.min.js"
"build": "PROD_ENV=1 webpack --optimize-minimize --optimize-dedupe",
"watch": "webpack --debug --devtool eval-cheap-module-source-map --output-pathinfo --progress --colors --watch",
"serve": "webpack-dev-server --debug --devtool eval-cheap-module-source-map --output-pathinfo --inline --hot --host localhost"
},
"main": "clmtracker.js",
"repository": {
"type": "git",
"url": "https://github.com/auduno/clmtrackr.git"
},
"devDependencies": {
"browserify": "^13.0.0",
"getusermedia": "^1.3.5",
"exdat": "^0.6.2",
"blob.js": "andyinabox/Blob.js",
"exdat": "^0.6.2",
"filesaver.js": "andyinabox/FileSaver.js",
"uglify": "^0.1.5",
"getusermedia": "^1.3.5",
"json-loader": "^0.5.4",
"raf": "^3.1.0",
"stats.js": "0.0.14-master"
"stats.js": "0.0.14-master",
"uglify": "^0.1.5",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.15.1"
},
"dependencies": {
"jsfeat": "0.0.8",
Expand Down
24 changes: 24 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';
const path = require('path');

const PROD = JSON.parse(process.env.PROD_ENV || '0');

module.exports = {
entry: {
clmtrackr: './js/index.js'
},
output: {
filename: PROD ? '[name].min.js' : '[name].js',
path: path.resolve(__dirname),
libraryTarget: 'umd',
library: 'clm'
},
module: {
loaders: [
{
test: /\.json$/,
loader: 'json-loader'
}
]
}
};

0 comments on commit 2bcfb0a

Please sign in to comment.