Sketchy/Gruntfile.js

174 lines
4.1 KiB
JavaScript
Raw Normal View History

2014-02-19 21:36:39 +00:00
var which;
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
2014-02-21 13:15:17 +00:00
manifest: grunt.file.readJSON('Mobile/manifest.webapp'),
2014-02-19 21:36:39 +00:00
uglify: {
main: {
files: [
{
expand: true,
cwd: 'Shared/js/',
src: '**',
dest: 'build/mobile/js/',
filter: 'isFile'
},
{
expand: true,
cwd: 'Shared/js',
src: '**',
dest: 'build/web/js',
filter: 'isFile'
},
2014-05-02 15:13:10 +00:00
{
expand: true,
cwd: 'Shared/js',
src: '**',
dest: 'build/android/js',
filter: 'isFile'
},
2014-02-19 21:36:39 +00:00
{
expand: true,
cwd: 'Mobile/js/',
src: '*',
dest: 'build/mobile/js',
filter: 'isFile'
},
2014-04-27 17:01:16 +00:00
{
expand: true,
cwd: 'Android/js/',
src: '*',
dest: 'build/android/js',
filter: 'isFile'
},
2014-02-19 21:36:39 +00:00
{
expand: true,
cwd: 'Web/js/',
src: '*',
dest: 'build/web/js',
filter: 'isFile'
}
]
}
},
less: {
production: {
files: {
'build/mobile/css/main.css': 'Shared/css/main.less',
2014-04-27 17:01:16 +00:00
'build/android/css/main.css': 'Shared/css/main.less',
2014-02-19 21:36:39 +00:00
'build/web/css/main.css': 'Shared/css/main.less'
},
compress: true
}
},
copy: {
'main files': {
files: [
{
expand: true,
cwd: 'Shared',
src: 'img/**',
2014-02-19 21:36:39 +00:00
dest: 'build/mobile'
},
{
expand: true,
cwd: 'Shared',
src: 'img/**',
2014-02-19 21:36:39 +00:00
dest: 'build/web'
},
{
expand: true,
cwd: 'Mobile',
src: ['index.html', 'manifest.webapp'],
dest: 'build/mobile'
},
2014-04-27 17:01:16 +00:00
{
expand: true,
cwd: 'Android',
2014-05-02 15:13:10 +00:00
src: ['index.html', 'config.xml', 'AndroidManifest.xml', 'res/**', 'icon.png'],
2014-04-27 17:01:16 +00:00
dest: 'build/android'
},
2014-02-19 21:36:39 +00:00
{
expand: true,
cwd: 'Web',
src: ['index.html', 'manifest.webapp', 'cache.appcache'],
dest: 'build/web'
}
]
},
'css assets': {
files: [
{
expand: true,
cwd: 'Shared/css',
src: '*/**',
dest: 'build/mobile/css'
},
2014-04-27 17:01:16 +00:00
{
expand: true,
cwd: 'Shared/css',
src: '*/**',
dest: 'build/android/css'
},
2014-02-19 21:36:39 +00:00
{
expand: true,
cwd: 'Shared/css',
src: '*/**',
dest: 'build/web/css'
}
]
}
},
2014-02-21 13:15:17 +00:00
zip: {
mobile: {
router: function(path) {
return /build\/mobile\/(.*)/.exec(path)[1];
},
src: 'build/mobile/**',
2014-02-21 13:16:15 +00:00
dest: 'sketchy-mobile-<%= manifest.version %>.zip'
2014-02-21 13:15:17 +00:00
},
web: {
router: function(path) {
return /build\/web\/(.*)/.exec(path)[1];
},
src: 'build/web/**',
2014-02-21 13:16:15 +00:00
dest: 'sketchy-web-<%= manifest.version %>.zip'
2014-02-21 13:15:17 +00:00
}
},
2014-02-19 21:36:39 +00:00
watch: {
js: {
files: ['Shared/js/**', 'Mobile/js/**', 'Web/js/**'],
tasks: 'uglify',
options: {
spawn: false
}
},
less: {
files: 'Shared/css/**',
tasks: 'less',
options: {
spawn: false
}
},
copy: {
files: ['Shared/img/**', 'Mobile/index.html', 'Mobile/manifest.webapp', 'Web/index.html', 'Web/manifest.webapp', 'Web/cache.appcache'],
2014-02-19 21:36:39 +00:00
tasks: 'copy',
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
2014-02-21 13:15:17 +00:00
grunt.loadNpmTasks('grunt-zip');
grunt.registerTask('default', ['uglify','copy', 'less', 'zip'])
2014-02-19 21:36:39 +00:00
}