habitica-self-host/Gruntfile.js

175 lines
6.2 KiB
JavaScript
Raw Normal View History

2013-09-06 17:19:43 +00:00
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
clean: {
build: ['build']
2013-09-06 17:19:43 +00:00
},
uglify: {
buildApp: {
files: {
'build/app.js': [
2013-09-06 17:19:43 +00:00
'public/bower_components/jquery/jquery.min.js',
'public/bower_components/bootstrap-growl/jquery.bootstrap-growl.min.js',
'public/bower_components/angular/angular.min.js',
'public/bower_components/angular-sanitize/angular-sanitize.min.js',
'public/bower_components/marked/lib/marked.js',
2013-09-06 17:19:43 +00:00
'public/bower_components/angular-route/angular-route.min.js',
'public/bower_components/angular-resource/angular-resource.min.js',
'public/bower_components/angular-ui/build/angular-ui.min.js',
'public/bower_components/angular-ui-utils/modules/keypress/keypress.js',
// we'll remove this once angular-bootstrap is fixed
'public/bower_components/bootstrap/docs/assets/js/bootstrap.min.js',
'public/bower_components/angular-bootstrap/ui-bootstrap.min.js',
'public/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
// Sortable
'public/bower_components/jquery-ui/ui/minified/jquery.ui.core.min.js',
'public/bower_components/jquery-ui/ui/minified/jquery.ui.widget.min.js',
'public/bower_components/jquery-ui/ui/minified/jquery.ui.mouse.min.js',
'public/bower_components/jquery-ui/ui/minified/jquery.ui.sortable.min.js',
// habitrpg-shared
'public/bower_components/habitrpg-shared/dist/habitrpg-shared.js',
// app
'public/js/app.js',
'public/js/services/authServices.js',
'public/js/services/notificationServices.js',
'public/js/services/sharedServices.js',
'public/js/services/userServices.js',
'public/js/services/groupServices.js',
'public/js/services/memberServices.js',
2013-09-06 17:19:43 +00:00
'public/js/filters/filters.js',
'public/js/directives/directives.js',
'public/js/controllers/authCtrl.js',
'public/js/controllers/menuCtrl.js',
'public/js/controllers/notificationCtrl.js',
'public/js/controllers/rootCtrl.js',
'public/js/controllers/settingsCtrl.js',
'public/js/controllers/statsCtrl.js',
'public/js/controllers/tasksCtrl.js',
'public/js/controllers/taskDetailsCtrl.js',
'public/js/controllers/filtersCtrl.js',
'public/js/controllers/userCtrl.js',
2013-09-06 17:19:43 +00:00
'public/js/controllers/groupsCtrl.js',
'public/js/controllers/petsCtrl.js',
'public/js/controllers/inventoryCtrl.js',
'public/js/controllers/marketCtrl.js',
'public/js/controllers/footerCtrl.js'
]
}
},
buildStatic: {
files: {
'build/static.js': [
2013-09-06 17:19:43 +00:00
'public/bower_components/jquery/jquery.min.js',
'public/bower_components/habitrpg-shared/dist/habitrpg-shared.js',
'public/bower_components/angular/angular.min.js',
'public/bower_components/angular-resource/angular-resource.min.js',
2013-09-06 17:19:43 +00:00
'public/bower_components/bootstrap/docs/assets/js/bootstrap.min.js',
'public/js/static.js',
'public/js/services/memberServices.js',
2013-09-06 17:19:43 +00:00
'public/js/services/userServices.js',
'public/js/controllers/authCtrl.js'
]
}
}
},
2013-09-06 19:39:18 +00:00
stylus: {
build: {
options: {
compress: false, // AFTER
'include css': true,
paths: ['public']
},
files: {
'build/app.css': ['public/css/index.styl'],
'build/static.css': ['public/css/static.styl']
2013-09-06 19:39:18 +00:00
}
}
},
cssmin: {
build: {
files: {
'build/app.css': ['build/app.css'],
'build/static.css': ['build/static.css'],
'build/bower_components/habitrpg-shared/dist/spritesheets.css': ['public/bower_components/habitrpg-shared/dist/spritesheets.css'],
'build/bower_components/bootstrap/docs/assets/css/bootstrap.css': ['public/bower_components/bootstrap/docs/assets/css/bootstrap.css'],
'build/bower_components/bootstrap/docs/assets/css/bootstrap-responsive.css': ['public/bower_components/bootstrap/docs/assets/css/bootstrap-responsive.css'],
'build/bower_components/bootstrap/docs/assets/css/docs.css': ['public/bower_components/bootstrap/docs/assets/css/docs.css']
2013-09-06 19:39:18 +00:00
}
}
2013-09-06 20:33:00 +00:00
},
2013-09-10 12:40:00 +00:00
copy: {
build: {
files: [{expand: true, cwd: 'public/', src: 'favicon.ico', dest: 'build/'}]
}
},
2013-09-10 12:43:30 +00:00
// UPDATE IT WHEN YOU ADD SOME FILES NOT ALREADY MATCHED!
hashres: {
build: {
options: {
fileNameFormat: '${name}-${hash}.${ext}'
},
src: [
2013-09-10 12:40:00 +00:00
'build/*.js', 'build/*.css', 'build/favicon.ico',
'build/bower_components/bootstrap/docs/assets/css/*.css',
'build/bower_components/habitrpg-shared/dist/*.css'
],
dest: 'make-sure-i-do-not-exist'
}
},
2013-09-07 10:47:44 +00:00
nodemon: {
dev: {
2013-09-10 12:43:30 +00:00
ignoredFiles: ['public/*', 'Gruntfile.js', 'views/*', 'build/*']
2013-09-07 10:47:44 +00:00
}
},
watch: {
dev: {
2013-09-10 20:57:34 +00:00
files: ['public/**/*.styl'], // 'public/**/*.js' Not needed because not in production
2013-09-07 10:47:44 +00:00
tasks: [ 'build:dev' ],
options: {
nospawn: true
2013-09-06 20:33:00 +00:00
}
}
2013-09-07 10:47:44 +00:00
},
2013-09-06 19:39:18 +00:00
2013-09-07 10:47:44 +00:00
concurrent: {
dev: ['nodemon', 'watch'],
2013-09-06 17:19:43 +00:00
options: {
2013-09-07 10:47:44 +00:00
logConcurrentOutput: true
2013-09-06 17:19:43 +00:00
}
2013-09-07 10:47:44 +00:00
}
2013-09-06 17:19:43 +00:00
});
// Register tasks.
2013-09-10 12:40:00 +00:00
grunt.registerTask('build:prod', ['clean:build', 'uglify', 'stylus', 'cssmin', 'copy:build', 'hashres']);
grunt.registerTask('build:dev', ['clean:build', 'stylus', 'cssmin', 'copy:build', 'hashres']);
2013-09-07 10:47:44 +00:00
grunt.registerTask('run:dev', [ 'build:dev', 'concurrent' ]);
2013-09-06 17:19:43 +00:00
// Load tasks
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
2013-09-06 19:39:18 +00:00
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-cssmin');
2013-09-10 12:40:00 +00:00
grunt.loadNpmTasks('grunt-contrib-copy');
2013-09-07 10:47:44 +00:00
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-hashres');
2013-09-06 17:19:43 +00:00
};