2013-05-21 09:38:18 -04:00
|
|
|
module.exports = function(grunt) {
|
2013-05-22 04:16:26 -04:00
|
|
|
'use strict';
|
2013-05-21 09:38:18 -04:00
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
2013-05-22 04:16:26 -04:00
|
|
|
connect: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
port: 8580,
|
|
|
|
base: '.',
|
|
|
|
keepalive: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
options: {
|
|
|
|
port: 8581,
|
|
|
|
base: '.'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
prod: {
|
|
|
|
options: {
|
|
|
|
port: process.env.PORT || 8585,
|
|
|
|
base: './src/',
|
|
|
|
keepalive: true,
|
|
|
|
middleware: function(connect, options) {
|
|
|
|
// Return array of whatever middlewares you want
|
|
|
|
return [
|
|
|
|
|
|
|
|
function(req, res, next) {
|
|
|
|
res.setHeader('Content-Security-Policy', "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src *; object-src 'none'; style-src 'self' 'unsafe-inline'");
|
|
|
|
res.setHeader('X-Content-Security-Policy', "default-src *; script-src 'self' 'unsafe-eval'; options eval-script; object-src 'none'; style-src 'self' 'unsafe-inline'");
|
|
|
|
res.setHeader('X-WebKit-CSP', "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src *; object-src 'none'; style-src 'self' 'unsafe-inline'");
|
|
|
|
|
|
|
|
return next();
|
|
|
|
},
|
|
|
|
|
|
|
|
// Serve static files.
|
|
|
|
connect.static(options.base)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-05-21 09:38:18 -04:00
|
|
|
jshint: {
|
2013-06-04 15:36:13 -04:00
|
|
|
all: ['Gruntfile.js', 'src/js/**/*.js'],
|
|
|
|
options: {
|
|
|
|
jshintrc: '.jshintrc'
|
|
|
|
}
|
2013-05-21 09:38:18 -04:00
|
|
|
},
|
2013-05-22 04:16:26 -04:00
|
|
|
|
2013-05-21 09:38:18 -04:00
|
|
|
qunit: {
|
|
|
|
all: {
|
|
|
|
options: {
|
2013-05-31 18:04:58 -04:00
|
|
|
urls: [
|
2013-06-04 15:36:13 -04:00
|
|
|
'http://localhost:<%= connect.test.options.port %>/test/unit/index.html',
|
|
|
|
'http://localhost:<%= connect.test.options.port %>/test/integration/index.html'
|
|
|
|
]
|
2013-05-21 09:38:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Load the plugin(s)
|
2013-05-22 04:16:26 -04:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
2013-05-21 09:38:18 -04:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
|
|
|
|
|
|
// Default task(s).
|
2013-05-22 04:16:26 -04:00
|
|
|
grunt.registerTask('dev', ['connect:dev']);
|
2013-06-04 15:36:13 -04:00
|
|
|
grunt.registerTask('test', ['connect:test', 'qunit']);
|
2013-05-22 04:16:26 -04:00
|
|
|
grunt.registerTask('prod', ['connect:prod']);
|
2013-05-21 09:38:18 -04:00
|
|
|
|
|
|
|
};
|