2016-11-14 16:16:51 +03:00
|
|
|
/* eslint-env node */
|
2017-01-04 18:40:56 +03:00
|
|
|
/* eslint-disable object-shorthand */
|
2017-03-30 15:27:01 +03:00
|
|
|
'use strict';
|
2016-05-24 15:07:31 +03:00
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
// 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 14:43:49 +03:00
|
|
|
clean: {
|
|
|
|
built: {
|
|
|
|
src: [
|
2016-11-15 19:17:08 +03:00
|
|
|
'dist/**'
|
2016-07-14 14:43:49 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
dependencies: {
|
|
|
|
src: [
|
|
|
|
'bower_components/**',
|
|
|
|
'node_modules/**'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
tmp: {
|
|
|
|
src: ['tmp/**']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-08-06 12:26:24 +03:00
|
|
|
watch: {
|
|
|
|
csscomb: {
|
|
|
|
files: ['app/styles/**/*.css'],
|
|
|
|
tasks: ['shell:csscombfix']
|
2016-08-03 10:54:24 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-05-24 15:07:31 +03:00
|
|
|
shell: {
|
2016-06-18 20:30:35 +03:00
|
|
|
'npm-install': {
|
2017-04-04 13:36:17 +03:00
|
|
|
command: 'yarn install'
|
2016-06-18 20:30:35 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
'bower-install': {
|
2016-08-03 10:54:24 +03:00
|
|
|
command: 'bower install'
|
|
|
|
},
|
|
|
|
|
|
|
|
ember: {
|
|
|
|
command: function (mode) {
|
2017-03-30 15:27:01 +03:00
|
|
|
let liveReloadBaseUrl = grunt.option('live-reload-base-url') || '/ghost/';
|
|
|
|
|
2016-08-03 10:54:24 +03:00
|
|
|
switch (mode) {
|
2016-11-14 16:16:51 +03:00
|
|
|
case 'prod':
|
|
|
|
return 'npm run build -- --environment=production --silent';
|
|
|
|
case 'dev':
|
|
|
|
return 'npm run build';
|
2017-03-16 17:39:57 +03:00
|
|
|
case 'watch':
|
2017-03-30 15:27:01 +03:00
|
|
|
return `npm run start -- --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`;
|
2016-08-03 10:54:24 +03:00
|
|
|
}
|
|
|
|
}
|
2016-06-18 20:30:35 +03:00
|
|
|
},
|
|
|
|
|
2016-05-24 15:07:31 +03:00
|
|
|
csscombfix: {
|
2016-08-03 10:54:24 +03:00
|
|
|
command: 'csscomb -c app/styles/csscomb.json -v app/styles'
|
2016-05-24 15:07:31 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
csscomblint: {
|
2016-08-03 10:54:24 +03:00
|
|
|
command: 'csscomb -c app/styles/csscomb.json -lv app/styles'
|
|
|
|
},
|
|
|
|
|
|
|
|
test: {
|
|
|
|
command: 'npm test'
|
|
|
|
},
|
|
|
|
|
|
|
|
options: {
|
|
|
|
preferLocal: true
|
2016-05-24 15:07:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-06-18 20:30:35 +03:00
|
|
|
grunt.registerTask('init', 'Install the client dependencies',
|
2016-10-17 11:58:44 +03:00
|
|
|
['shell:npm-install', 'shell:bower-install']
|
2016-06-18 20:30:35 +03:00
|
|
|
);
|
2016-05-24 15:07:31 +03:00
|
|
|
};
|