2016-11-14 14:16:51 +01:00
|
|
|
/* eslint-env node */
|
2017-01-04 16:40:56 +01:00
|
|
|
/* eslint-disable object-shorthand */
|
2017-03-30 14:27:01 +02:00
|
|
|
'use strict';
|
2016-05-24 14:07:31 +02:00
|
|
|
|
2018-01-05 16:38:23 +01:00
|
|
|
module.exports = function (grunt) {
|
2016-05-24 14:07:31 +02:00
|
|
|
// Find all of the task which start with `grunt-` and load them, rather than explicitly declaring them all
|
|
|
|
require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);
|
|
|
|
|
|
|
|
grunt.initConfig({
|
2016-07-14 13:43:49 +02:00
|
|
|
clean: {
|
|
|
|
built: {
|
2018-03-19 18:56:09 +01:00
|
|
|
src: ['dist/**']
|
2016-07-14 13:43:49 +02:00
|
|
|
},
|
|
|
|
dependencies: {
|
2018-03-19 18:56:09 +01:00
|
|
|
src: ['node_modules/**']
|
2016-07-14 13:43:49 +02:00
|
|
|
},
|
|
|
|
tmp: {
|
|
|
|
src: ['tmp/**']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-08-06 11:26:24 +02:00
|
|
|
watch: {
|
|
|
|
csscomb: {
|
|
|
|
files: ['app/styles/**/*.css'],
|
|
|
|
tasks: ['shell:csscombfix']
|
2016-08-03 09:54:24 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-05-24 14:07:31 +02:00
|
|
|
shell: {
|
2016-06-18 19:30:35 +02:00
|
|
|
'npm-install': {
|
2017-04-04 12:36:17 +02:00
|
|
|
command: 'yarn install'
|
2016-06-18 19:30:35 +02:00
|
|
|
},
|
|
|
|
|
2016-08-03 09:54:24 +02:00
|
|
|
ember: {
|
|
|
|
command: function (mode) {
|
2017-03-30 14:27:01 +02:00
|
|
|
let liveReloadBaseUrl = grunt.option('live-reload-base-url') || '/ghost/';
|
|
|
|
|
2016-08-03 09:54:24 +02:00
|
|
|
switch (mode) {
|
2016-11-14 14:16:51 +01:00
|
|
|
case 'prod':
|
|
|
|
return 'npm run build -- --environment=production --silent';
|
|
|
|
case 'dev':
|
|
|
|
return 'npm run build';
|
2017-03-16 15:39:57 +01:00
|
|
|
case 'watch':
|
2017-03-30 14:27:01 +02:00
|
|
|
return `npm run start -- --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
2016-08-03 09:54:24 +02:00
|
|
|
}
|
|
|
|
}
|
2016-06-18 19:30:35 +02:00
|
|
|
},
|
|
|
|
|
2016-05-24 14:07:31 +02:00
|
|
|
csscombfix: {
|
2016-08-03 09:54:24 +02:00
|
|
|
command: 'csscomb -c app/styles/csscomb.json -v app/styles'
|
2016-05-24 14:07:31 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
csscomblint: {
|
2016-08-03 09:54:24 +02:00
|
|
|
command: 'csscomb -c app/styles/csscomb.json -lv app/styles'
|
|
|
|
},
|
|
|
|
|
|
|
|
test: {
|
|
|
|
command: 'npm test'
|
|
|
|
},
|
|
|
|
|
|
|
|
options: {
|
|
|
|
preferLocal: true
|
2016-05-24 14:07:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-06-18 19:30:35 +02:00
|
|
|
grunt.registerTask('init', 'Install the client dependencies',
|
2018-03-19 18:56:09 +01:00
|
|
|
['shell:npm-install']
|
2016-06-18 19:30:35 +02:00
|
|
|
);
|
2016-05-24 14:07:31 +02:00
|
|
|
};
|