Skip to content

Instantly share code, notes, and snippets.

@brian-lim-42
Created May 21, 2017 23:12
Show Gist options
  • Save brian-lim-42/ed322e3013918232fbdb9b94ba25a721 to your computer and use it in GitHub Desktop.
Save brian-lim-42/ed322e3013918232fbdb9b94ba25a721 to your computer and use it in GitHub Desktop.
Portion of working Gruntfile.js
grunt.initConfig({
babel: {
options: {
sourceMap: false,
presets: ['es2015']
},
core: {
files: [{ expand: true, cwd: './', src: ['main.js', 'js/**/*.js'], dest: 'dist/'}]
},
scripts: {
files: [
{
expand: true,
cwd: './',
src: [
'models/**/*.js',
'scriptmodels/**/*.js',
'scripts/**/*.js'
],
dest: 'dist/'
}
]
}
},
copy: {
config: {
files: [
{ expand: true, src: ['config/**/*.json'], dest: 'dist/' },
{ expand: true, src: ['data/**/*.json'], dest: 'dist/' }
]
},
views: {
files: [{ expand: true, src: ['views/**/*.html'], dest: 'dist/'}]
}
},
clean: {
all: [
'temp/*',
'!temp/.gitignore',
'trash/*',
'!trash/.gitignore',
'dist/*',
'!dist/.gitignore',
]
},
exec: {
gen: {
cwd: './dist',
cmd: function (platform, appName) {
console.log('node main.js "config/' + appName + '/' + platform + '/' + appName + '.json"');
return 'node main.js "config/' + appName + '/' + platform + '/' + appName + '.json"';
}
}
},
watch: {
all: {
files: [
'js/**/*.js',
'config/**/*.json',
'data/**/*.json',
'views/**/*.html',
'scripts/**/*.js',
'scriptmodels/**/*.js'
],
tasks: [
'babel:core',
'babel:scripts',
'copy:config',
'copy:views'
]
},
core: {
files: ['js/**/*.js'],
tasks: ['babel:core']
},
config: {
files: ['config/**/*.json', 'data/**/*.json'],
tasks: ['copy:config']
},
html: {
files: ['views/**/*.html'],
tasks: ['copy:views']
},
scripts: {
files: [
'models/**/*.js',
'scripts/**/*.js',
'scriptmodels/**/*.js'
],
tasks: ['babel:scripts']
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment