2014-01-18 04:52:54 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
path = require('path');
|
|
|
|
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
2014-11-10 11:34:20 +03:00
|
|
|
// Load grunt tasks automatically
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
2014-01-18 04:52:54 +04:00
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
jshintrc: true
|
|
|
|
},
|
|
|
|
development: ['media/js/**/*.js']
|
|
|
|
},
|
2014-11-10 11:34:20 +03:00
|
|
|
jsonlint: {
|
|
|
|
all : {
|
|
|
|
src : [
|
|
|
|
'*.json',
|
|
|
|
'./**/*.json'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2014-01-18 04:52:54 +04:00
|
|
|
less: {
|
|
|
|
development: {
|
|
|
|
options: {
|
|
|
|
paths: ['media/css/']
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
'media/css/**/*.css': 'media/css/**/*.less'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
options: {
|
|
|
|
port: 35729,
|
|
|
|
livereload: true,
|
|
|
|
nospawn: true
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
files: ['media/css/**/*.less'],
|
|
|
|
tasks: ['less']
|
|
|
|
},
|
|
|
|
scripts: {
|
|
|
|
files: ['media/js/**/*.js'],
|
|
|
|
tasks: ['jshint']
|
|
|
|
},
|
|
|
|
html: {
|
|
|
|
files: ['bedrock/**/*.html']
|
2014-11-10 11:34:20 +03:00
|
|
|
},
|
|
|
|
json: {
|
|
|
|
files: ['*.json'],
|
|
|
|
tasks: ['jsonlint']
|
2014-01-18 04:52:54 +04:00
|
|
|
}
|
2014-02-18 16:39:43 +04:00
|
|
|
},
|
|
|
|
karma: {
|
|
|
|
unit: {
|
|
|
|
configFile: 'media/js/test/karma.conf.js'
|
|
|
|
}
|
2014-08-13 19:32:43 +04:00
|
|
|
},
|
|
|
|
clean: ['media/css/**/*.less.css']
|
2014-01-18 04:52:54 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Update the config to only build the changed files.
|
|
|
|
grunt.event.on('watch', function (action, filepath) {
|
|
|
|
grunt.config(['less', 'development', 'files'], [
|
|
|
|
{ src: filepath, dest: filepath + '.css' }
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.config(['jshint', 'development'], [filepath]);
|
|
|
|
|
2014-11-10 11:34:20 +03:00
|
|
|
grunt.config(['jsonlint', 'all'], [filepath]);
|
|
|
|
});
|
2014-01-18 04:52:54 +04:00
|
|
|
|
|
|
|
// Default task(s).
|
|
|
|
grunt.registerTask('default', ['watch']);
|
|
|
|
|
2015-01-23 14:45:12 +03:00
|
|
|
// Run JS tests in Firefox using Karma test runner
|
2014-02-18 16:39:43 +04:00
|
|
|
grunt.registerTask('test', ['karma']);
|
|
|
|
|
2014-01-18 04:52:54 +04:00
|
|
|
};
|