2015-12-08 10:56:02 -06:00
|
|
|
module.exports = function(config, grunt) {
|
2015-10-01 10:00:41 -05:00
|
|
|
'use strict';
|
|
|
|
|
2015-12-08 10:56:02 -06:00
|
|
|
grunt.event.on('watch', function(action, filepath) {
|
|
|
|
var newPath;
|
|
|
|
|
|
|
|
grunt.log.writeln('File Changed: ' + filepath);
|
|
|
|
|
2016-01-09 12:03:03 -06:00
|
|
|
if (/(\.html)|(\.json)$/.test(filepath)) {
|
2015-12-08 10:56:02 -06:00
|
|
|
newPath = filepath.replace(/^public/, 'public_gen');
|
|
|
|
grunt.log.writeln('Copying to ' + newPath);
|
|
|
|
grunt.file.copy(filepath, newPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (/(\.js)$/.test(filepath)) {
|
|
|
|
newPath = filepath.replace(/^public/, 'public_gen');
|
|
|
|
grunt.log.writeln('Copying to ' + newPath);
|
|
|
|
grunt.file.copy(filepath, newPath);
|
|
|
|
|
|
|
|
grunt.task.run('jshint');
|
|
|
|
grunt.task.run('jscs');
|
|
|
|
}
|
2015-09-09 12:34:24 -05:00
|
|
|
|
2016-02-15 08:27:41 -06:00
|
|
|
if (/(\.scss)$/.test(filepath)) {
|
2015-12-08 10:56:02 -06:00
|
|
|
grunt.task.run('clean:css');
|
2016-02-15 08:27:41 -06:00
|
|
|
grunt.task.run('sass');
|
2015-12-08 10:56:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (/(\.ts)$/.test(filepath)) {
|
2016-01-13 15:31:29 -06:00
|
|
|
newPath = filepath.replace(/^public/, 'public_gen');
|
|
|
|
grunt.log.writeln('Copying to ' + newPath);
|
|
|
|
grunt.file.copy(filepath, newPath);
|
|
|
|
|
|
|
|
// copy ts file also used by source maps
|
2015-12-08 10:56:02 -06:00
|
|
|
//changes changed file source to that of the changed file
|
|
|
|
var option = 'typescript.build.src';
|
|
|
|
var result = filepath;
|
|
|
|
grunt.config(option, result);
|
|
|
|
grunt.task.run('typescript:build');
|
|
|
|
grunt.task.run('tslint');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
2015-09-10 04:26:40 -05:00
|
|
|
copy_to_gen: {
|
2015-10-01 10:38:55 -05:00
|
|
|
files: ['<%= srcDir %>/**/*'],
|
2015-12-08 10:56:02 -06:00
|
|
|
tasks: [],
|
2015-09-09 12:34:24 -05:00
|
|
|
options: {
|
|
|
|
spawn: false
|
|
|
|
}
|
|
|
|
},
|
2014-08-10 07:03:10 -05:00
|
|
|
};
|
|
|
|
};
|