ca08c796c2ddceacc0b60c581d1a292b4c92c227
[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               useStrict: true,
16               baseUrl: 'src/editor',
17               mainConfigFile: 'src/editor/entrypoint.js',
18               out: build_output_dir + '/rng.js',
19               name: 'entrypoint',
20               include: ['libs/require']
21             }
22           }
23         },
24         less: {
25             production: {
26                 options: {
27                     paths: [''],
28                     cleancss: true,
29                     relativeUrls: true,
30                     rootpath: 'src/editor/styles/'
31                 },
32                 files: less_files,
33             },
34         },
35         jshint: {
36             all: ['Gruntfile.js', 'src/**/*.js'],
37             options: {
38                 jshintrc: '.jshintrc'
39             }
40         },
41         copy: {
42           resources: {
43             files: [
44               {src: ['libs/bootstrap/img/**'], dest: build_output_dir+'/'},
45             ]
46           }
47         }
48     });
49
50     grunt.loadNpmTasks('grunt-contrib-requirejs');
51     grunt.loadNpmTasks('grunt-contrib-less');
52     grunt.loadNpmTasks('grunt-contrib-jshint');
53     grunt.loadNpmTasks('grunt-contrib-copy');
54
55     grunt.registerTask('build', ['requirejs', 'less:production', 'copy:resources']);
56     grunt.registerTask('lint', ['jshint']);
57     grunt.registerTask('default', ['build']);
58 };