ux(dashboard): lots of tweaks and polish to row menu, added remove X to add panel and row option views, #6442
This commit is contained in:
+63
-39
@@ -1,53 +1,77 @@
|
||||
module.exports = function(config, grunt) {
|
||||
'use strict';
|
||||
|
||||
grunt.event.on('watch', function(action, filepath) {
|
||||
var newPath;
|
||||
var gaze = require('gaze');
|
||||
var path = require('path');
|
||||
var firstRun = true;
|
||||
var done;
|
||||
var lastTime;
|
||||
|
||||
grunt.log.writeln('File Changed: ' + filepath);
|
||||
grunt.registerTask('watch', function() {
|
||||
|
||||
if (/(\.html)|(\.json)$/.test(filepath)) {
|
||||
newPath = filepath.replace(/^public/, 'public_gen');
|
||||
grunt.log.writeln('Copying to ' + newPath);
|
||||
grunt.file.copy(filepath, newPath);
|
||||
done = this.async();
|
||||
lastTime = new Date().getTime();
|
||||
|
||||
if (firstRun === false) {
|
||||
grunt.log.writeln('Watch resuming');
|
||||
return;
|
||||
}
|
||||
|
||||
if (/(\.js)$/.test(filepath)) {
|
||||
newPath = filepath.replace(/^public/, 'public_gen');
|
||||
grunt.log.writeln('Copying to ' + newPath);
|
||||
grunt.file.copy(filepath, newPath);
|
||||
gaze(config.srcDir + '/**/*', function(err, watcher) {
|
||||
|
||||
grunt.task.run('jshint');
|
||||
grunt.task.run('jscs');
|
||||
}
|
||||
console.log('Gaze watchers setup');
|
||||
|
||||
if (/(\.scss)$/.test(filepath)) {
|
||||
grunt.task.run('clean:css');
|
||||
grunt.task.run('css');
|
||||
}
|
||||
watcher.on('all', function(evtName, filepath) {
|
||||
filepath = path.relative(process.cwd(), filepath);
|
||||
|
||||
if (/(\.ts)$/.test(filepath)) {
|
||||
newPath = filepath.replace(/^public/, 'public_gen');
|
||||
grunt.log.writeln('Copying to ' + newPath);
|
||||
grunt.file.copy(filepath, newPath);
|
||||
// ignore multiple changes at once
|
||||
var now = new Date().getTime();
|
||||
if (now - lastTime < 100) {
|
||||
return;
|
||||
}
|
||||
lastTime = now;
|
||||
|
||||
// copy ts file also used by source maps
|
||||
//changes changed file source to that of the changed file
|
||||
grunt.config('typescript.build.src', filepath);
|
||||
grunt.config('tslint.source.files.src', filepath);
|
||||
var newPath;
|
||||
grunt.log.writeln('File Changed: ', filepath);
|
||||
|
||||
grunt.task.run('typescript:build');
|
||||
grunt.task.run('tslint');
|
||||
}
|
||||
if (/(\.html)|(\.json)$/.test(filepath)) {
|
||||
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');
|
||||
}
|
||||
|
||||
if (/(\.scss)$/.test(filepath)) {
|
||||
grunt.task.run('clean:css');
|
||||
grunt.task.run('css');
|
||||
}
|
||||
|
||||
if (/(\.ts)$/.test(filepath)) {
|
||||
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
|
||||
//changes changed file source to that of the changed file
|
||||
grunt.config('typescript.build.src', filepath);
|
||||
grunt.config('tslint.source.files.src', filepath);
|
||||
|
||||
grunt.task.run('typescript:build');
|
||||
grunt.task.run('tslint');
|
||||
}
|
||||
|
||||
done();
|
||||
firstRun = false;
|
||||
grunt.task.run('watch');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
copy_to_gen: {
|
||||
files: ['<%= srcDir %>/**/*'],
|
||||
tasks: [],
|
||||
options: {
|
||||
spawn: false
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user