5c85ee03a22eb9682e8fe58d19ce9808c152c97f
[fnpeditor.git] / Gruntfile.js
1 /* global module */
2
3 module.exports = function(grunt) {
4     'use strict';
5
6     var build_output_dir = grunt.option('output-dir') || 'build',
7         less_files = {};
8
9     less_files[build_output_dir + '/rng.css'] = 'src/editor/styles/main.less';
10
11     grunt.initConfig({
12         requirejs: {
13           compile: {
14             options: {
15               baseUrl: 'src/editor',
16               mainConfigFile: 'src/editor/entrypoint.js',
17               out: build_output_dir + '/rng.js',
18               name: 'entrypoint',
19               include: ['libs/require']
20             }
21           }
22         },
23         less: {
24             production: {
25                 options: {
26                     paths: [''],
27                     cleancss: true,
28                     relativeUrls: true
29                 },
30                 files: less_files,
31             },
32         },
33         jshint: {
34             all: ['Gruntfile.js', 'src/**/*.js'],
35             options: {
36                 jshintrc: '.jshintrc'
37             }
38         },
39         copy: {
40           resources: {
41             files: [
42               {src: ['libs/bootstrap/img/**'], dest: build_output_dir+'/'},
43             ]
44           }
45         }
46     });
47
48     grunt.loadNpmTasks('grunt-contrib-requirejs');
49     grunt.loadNpmTasks('grunt-contrib-less');
50     grunt.loadNpmTasks('grunt-contrib-jshint');
51     grunt.loadNpmTasks('grunt-contrib-copy');
52
53     grunt.registerTask('build', ['requirejs', 'less:production', 'copy:resources']);
54     grunt.registerTask('lint', ['jshint']);
55     grunt.registerTask('default', ['build']);
56 };