2015-08-29 19:19:16 +00:00
|
|
|
module.exports = function(grunt) {
|
2015-08-30 11:18:25 +00:00
|
|
|
require('grunt-task-loader')(grunt);
|
|
|
|
|
2015-08-29 19:19:16 +00:00
|
|
|
grunt.initConfig({
|
2015-08-30 11:18:25 +00:00
|
|
|
browserify: {
|
|
|
|
dev: {
|
2015-09-03 10:32:46 +00:00
|
|
|
files: [{
|
|
|
|
dest: 'build/main.js',
|
|
|
|
src: ['src/js/**/*', '!src/js/libs/**']
|
|
|
|
}],
|
2015-08-30 11:18:25 +00:00
|
|
|
options: {
|
2015-08-31 06:49:22 +00:00
|
|
|
alias: {
|
2015-09-03 10:32:46 +00:00
|
|
|
store: './src/js/store.js',
|
2015-09-06 13:02:50 +00:00
|
|
|
utils: './src/js/utils.js',
|
|
|
|
tour: './src/js/tour.js'
|
2015-08-31 06:49:22 +00:00
|
|
|
},
|
|
|
|
transform: [['babelify', {
|
|
|
|
optional: ['es7.asyncFunctions', 'asyncToGenerator',
|
|
|
|
'es7.decorators'],
|
|
|
|
blacklist: []
|
|
|
|
}]],
|
2015-08-30 11:18:25 +00:00
|
|
|
plugin: [
|
|
|
|
[
|
|
|
|
'remapify', [
|
|
|
|
{
|
|
|
|
src: '**/*.js',
|
|
|
|
expose: 'components',
|
|
|
|
cwd: __dirname + '/src/js/components/'
|
2015-08-31 06:49:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
src: '**/*.js',
|
|
|
|
expose: 'actions',
|
|
|
|
cwd: __dirname + '/src/js/actions'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: '**/*.js',
|
|
|
|
expose: 'reducers',
|
|
|
|
cwd: __dirname + '/src/js/reducers'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: '**/*.js',
|
|
|
|
expose: 'api',
|
|
|
|
cwd: __dirname + '/src/js/api'
|
2015-09-03 10:32:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
src: '**/*.js',
|
|
|
|
expose: 'libs',
|
|
|
|
cwd: __dirname + '/src/js/libs'
|
2015-08-30 11:18:25 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
2015-09-03 10:32:46 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mochify: {
|
|
|
|
options: {
|
|
|
|
reporter: 'land'
|
2015-08-30 11:18:25 +00:00
|
|
|
},
|
2015-09-03 10:32:46 +00:00
|
|
|
tests: {
|
|
|
|
src: 'test/**/*.js',
|
|
|
|
options: '<%= browserify.dev.options %>'
|
2015-08-30 11:18:25 +00:00
|
|
|
}
|
|
|
|
},
|
2015-08-29 19:19:16 +00:00
|
|
|
less: {
|
2015-08-30 11:18:25 +00:00
|
|
|
dev: {
|
2015-08-29 19:19:16 +00:00
|
|
|
files: [{
|
2015-09-03 10:32:46 +00:00
|
|
|
src: 'src/less/main.less',
|
|
|
|
dest: 'build/style.css'
|
2015-08-29 19:19:16 +00:00
|
|
|
}]
|
|
|
|
},
|
2015-08-30 11:18:25 +00:00
|
|
|
prod: {
|
2015-08-29 19:19:16 +00:00
|
|
|
options: {
|
|
|
|
plugins: require('less-plugin-clean-css')()
|
|
|
|
},
|
|
|
|
files: [{
|
2015-09-03 10:32:46 +00:00
|
|
|
src: 'src/less/main.less',
|
|
|
|
dest: 'build/style.css'
|
2015-08-29 19:19:16 +00:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
2015-08-31 06:49:22 +00:00
|
|
|
copy: {
|
|
|
|
assets: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src',
|
|
|
|
dest: 'build',
|
|
|
|
src: ['index.html', 'manifest.webapp',
|
2015-09-05 11:39:09 +00:00
|
|
|
'fonts/**', 'img/**', 'js/libs/**', 'icon/**']
|
2015-08-31 06:49:22 +00:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
2015-09-03 10:32:46 +00:00
|
|
|
mochaTest: {
|
|
|
|
tests: {
|
|
|
|
src: ['tests/**/*.js'],
|
|
|
|
options: {
|
|
|
|
reporter: 'landing'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-08-29 19:19:16 +00:00
|
|
|
watch: {
|
|
|
|
styles: {
|
2015-08-31 06:49:22 +00:00
|
|
|
files: ['src/less/**/*.less'],
|
|
|
|
tasks: ['less:dev']
|
|
|
|
},
|
|
|
|
scripts: {
|
|
|
|
files: ['src/js/**/*'],
|
|
|
|
tasks: ['browserify:dev']
|
|
|
|
},
|
|
|
|
assets: {
|
|
|
|
files: ['src/index.html', 'src/manifest.webapp',
|
|
|
|
'src/fonts/**', 'src/img/**', 'src/data/**'],
|
|
|
|
tasks: ['copy']
|
2015-08-29 19:19:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-08-31 06:49:22 +00:00
|
|
|
grunt.registerTask('default', ['browserify:dev', 'less:dev', 'copy']);
|
|
|
|
grunt.registerTask('production', ['browserify:prod', 'less:prod', 'copy']);
|
2015-09-03 10:32:46 +00:00
|
|
|
grunt.registerTask('test', 'mochaTest');
|
2015-08-29 19:19:16 +00:00
|
|
|
};
|