2014-09-10 02:22:26 +00:00
|
|
|
var cssfiles = {
|
2014-09-13 21:57:01 +00:00
|
|
|
"../libmproxy/web/static/css/app.css": "src/css/app.less",
|
|
|
|
"../libmproxy/web/static/css/vendor.css": "src/css/vendor.less",
|
2014-09-10 02:22:26 +00:00
|
|
|
};
|
|
|
|
var jsfiles = {
|
2014-09-13 21:57:01 +00:00
|
|
|
"../libmproxy/web/static/js/vendor.js": [
|
2014-09-10 02:22:26 +00:00
|
|
|
'src/vendor/jquery/jquery.js',
|
2014-09-13 21:57:01 +00:00
|
|
|
'src/vendor/lodash/lodash.js',
|
2014-09-10 02:22:26 +00:00
|
|
|
'src/vendor/react/react-with-addons.js',
|
2014-09-13 21:57:01 +00:00
|
|
|
'src/vendor/react-router/react-router.js',
|
|
|
|
'src/vendor/react-bootstrap/react-bootstrap.js',
|
|
|
|
],
|
|
|
|
"../libmproxy/web/static/js/app.js": [
|
|
|
|
'src/js/datastructures.compiled.js',
|
|
|
|
'src/js/footer.compiled.js',
|
|
|
|
'src/js/header.compiled.js',
|
|
|
|
'src/js/mitmproxy.compiled.js',
|
2014-09-10 02:22:26 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
"use strict";
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON("package.json"),
|
|
|
|
copy: {
|
|
|
|
all: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
2014-09-13 21:57:01 +00:00
|
|
|
src: ['src/vendor/fontawesome/fontawesome-webfont.*'],
|
2014-09-10 02:22:26 +00:00
|
|
|
dest: '../libmproxy/web/static/fonts'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
less: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
paths: ["src/css"],
|
|
|
|
sourceMap: true
|
|
|
|
},
|
|
|
|
files: cssfiles
|
|
|
|
},
|
|
|
|
prod: {
|
|
|
|
options: {
|
|
|
|
paths: ["src/css"],
|
|
|
|
cleancss: true,
|
|
|
|
report: "gzip"
|
|
|
|
},
|
|
|
|
files: cssfiles
|
|
|
|
}
|
|
|
|
},
|
|
|
|
react: {
|
|
|
|
all: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/js',
|
2014-09-13 21:57:01 +00:00
|
|
|
src: ['*.react.js','*.es6.js'],
|
2014-09-10 02:22:26 +00:00
|
|
|
dest: 'src/js',
|
2014-09-13 21:57:01 +00:00
|
|
|
ext: '.compiled.js'
|
2014-09-10 02:22:26 +00:00
|
|
|
}]
|
2014-09-13 21:57:01 +00:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
harmony: true
|
2014-09-10 02:22:26 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
mangle: false,
|
|
|
|
compress: false,
|
2014-09-13 21:57:01 +00:00
|
|
|
beautify: true,
|
2014-09-10 02:22:26 +00:00
|
|
|
sourceMap: true,
|
|
|
|
sourceMapIncludeSources: true,
|
|
|
|
},
|
|
|
|
files: jsfiles
|
|
|
|
},
|
|
|
|
prod: {
|
|
|
|
options: {
|
|
|
|
report: "gzip",
|
|
|
|
compress: true,
|
|
|
|
},
|
|
|
|
files: jsfiles
|
|
|
|
},
|
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
options: {
|
2014-09-13 21:57:01 +00:00
|
|
|
jshintrc: ".jshintrc",
|
2014-09-10 02:22:26 +00:00
|
|
|
},
|
2014-09-13 21:57:01 +00:00
|
|
|
all: ['src/js/*.js','!src/js/*.react.js'],
|
2014-09-10 02:22:26 +00:00
|
|
|
gruntfile: ['Gruntfile.js']
|
|
|
|
},
|
|
|
|
qunit: {
|
|
|
|
all: ['src/test.html']
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
less: {
|
2014-09-13 21:57:01 +00:00
|
|
|
files: ['src/css/**'],
|
2014-09-10 02:22:26 +00:00
|
|
|
tasks: ['less:dev'],
|
|
|
|
options: {
|
|
|
|
livereload: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
jsx: {
|
2014-09-13 21:57:01 +00:00
|
|
|
files: ['src/js/*.react.js','src/js/*.es6.js'],
|
2014-09-10 02:22:26 +00:00
|
|
|
tasks: ['react:all'],
|
|
|
|
},
|
|
|
|
js: {
|
|
|
|
files: ['src/js/*.js'],
|
|
|
|
tasks: ['jshint:all', 'uglify:dev'],
|
|
|
|
options: {
|
|
|
|
livereload: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
files: ['src/*.html', 'src/examples/**'],
|
|
|
|
tasks: ['copy:all'],
|
|
|
|
options: {
|
|
|
|
livereload: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
gruntfile: {
|
|
|
|
files: './Gruntfile.js',
|
|
|
|
tasks: ['jshint:gruntfile'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
notify: {
|
|
|
|
done: {
|
|
|
|
options: {
|
|
|
|
message: 'Done!'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
|
|
grunt.loadNpmTasks('grunt-notify');
|
|
|
|
grunt.loadNpmTasks('grunt-shell');
|
|
|
|
grunt.loadNpmTasks('grunt-react');
|
|
|
|
grunt.registerTask(
|
|
|
|
'prod', ['react:all', 'jshint:all', 'copy:all', 'uglify:prod', 'less:prod']
|
|
|
|
);
|
|
|
|
grunt.registerTask(
|
|
|
|
'dev', ['react:all', 'jshint:all', 'copy:all', 'uglify:dev', 'less:dev']
|
|
|
|
);
|
|
|
|
grunt.registerTask('test', ['qunit:all']);
|
|
|
|
|
|
|
|
};
|