-
Notifications
You must be signed in to change notification settings - Fork 32
/
gruntfile.js
57 lines (51 loc) · 1.78 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const path = require('path');
const electron = require('electron-connect').server.create();
const lessGlob = require('less-plugin-glob');
module.exports = function gruntTask(grunt) {
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-env');
grunt.registerTask('start', 'Start-Up electron server', () => {
electron.start(['.', 'DEV_STYLE']);
});
grunt.registerTask('restart', 'Restart Ride and go into a session.', () => {
electron.broadcast('reboot', { message: 'Shutdown then restart.' });
});
grunt.registerTask('reload-css', 'Attempt to live reload the CSS without having to restart/reload Ride', () => {
electron.broadcast('css_update', { message: 'Trigger styling reload.' });
});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
env: {
spawn: { RIDE_SPAWN: 'dyalog' },
},
less: {
development: {
options: {
paths: [path.join(__dirname, 'style', 'less')],
plugins: [lessGlob],
strictMath: true,
},
files: {
'./style/ride-base.css': './style/layout.less',
'./style/dark-theme.css': './style/dark-theme.less',
'./style/light-theme.css': './style/light-theme.less',
},
},
},
watch: {
restart: {
files: ['style/less/**/*.less', 'style/*.less'],
tasks: ['less', 'env', 'restart'],
options: { spawn: false },
},
css_reload: {
files: ['style/less/**/*.less', 'style/*.less'],
tasks: ['less', 'reload-css'],
options: { spawn: false },
},
},
});
grunt.registerTask('default', ['start', 'less', 'watch:css_reload']);
grunt.registerTask('spawn-reload', ['env', 'start', 'less', 'watch:restart']);
};