fix weird selection after delete
[fnpeditor.git] / Gruntfile.js
1 /* global module */
2
3 module.exports = function(grunt) {
4     'use strict';
5     var build_output_dir = grunt.option('output-dir') || 'build',
6         less_files = {},
7         jshint_targets = grunt.option('jshint-targets');
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', 'libs/ace/mode-xml'],
21               generateSourceMaps: true,
22
23               // The following two settings are required for source maps to work,
24               // see: http://requirejs.org/docs/optimization.html#sourcemaps
25               preserveLicenseComments: false,
26               optimize: grunt.option('optimize') || 'uglify2'
27             }
28           }
29         },
30         less: {
31             production: {
32                 options: {
33                     paths: [''],
34                     cleancss: true,
35                     relativeUrls: true,
36                     rootpath: 'src/editor/styles/'
37                 },
38                 files: less_files,
39             },
40         },
41         jshint: {
42             all: jshint_targets ? jshint_targets.split(',') : ['Gruntfile.js', 'src/**/*.js'],
43             options: {
44                 jshintrc: '.jshintrc'
45             }
46         },
47         copy: {
48           resources: {
49             files: [
50               {src: ['libs/bootstrap/img/**'], dest: build_output_dir+'/'},
51             ]
52           }
53         },
54         githooks: {
55             all: {
56                 options: {
57                     dest: grunt.option('git-hooks-dir') || '.git/hooks',
58                 },
59                 'pre-commit': {
60                     taskNames: ['lint'],
61                     args: '--no-color',
62                     template: 'pre-commit.template.js'
63                 }
64             }
65         }
66     });
67
68     grunt.loadNpmTasks('grunt-contrib-requirejs');
69     grunt.loadNpmTasks('grunt-contrib-less');
70     grunt.loadNpmTasks('grunt-contrib-jshint');
71     grunt.loadNpmTasks('grunt-contrib-copy');
72     grunt.loadNpmTasks('grunt-githooks');
73
74     grunt.registerTask('build', ['requirejs', 'less:production', 'copy:resources']);
75     grunt.registerTask('lint', ['jshint']);
76     grunt.registerTask('default', ['build']);
77 };