Subversion Repositories wimsdev

Rev

Rev 11729 | Rev 13572 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11729 Rev 13570
Line 1... Line 1...
1
module.exports = function(grunt){
1
module.exports = function(grunt){
2
 
2
 
3
  grunt.initConfig({
3
  grunt.initConfig({
4
 
4
 
5
    // Vérifie que nos js sont corrects (on considere que les js des librairies le sont deja.)
5
    // Vérifie que nos js sont corrects (on considere que les js des librairies le sont deja.)
6
    jshint: {
6
    eslint: {
7
      /*all: ['../../scripts/js/*.js'],*/
7
      /*all: ['../../scripts/js/*.js'],*/
8
      /*ASCII: ['../../scripts/js/ASCII*.js'],*/
8
      /*ASCII: ['../../scripts/js/ASCII*.js'],*/
9
      /*utils: ['../../scripts/js/utils.js'],*/
9
      /*utils: ['../../scripts/js/utils.js'],*/
10
      /*wz: ['../../scripts/js/wz*.js'],*/
10
      /*wz: ['../../scripts/js/wz*.js'],*/
11
      interface: ['../../scripts/js/interface/*.js'],
11
      interface: ['../../scripts/js/interface/*.js'],
Line 18... Line 18...
18
      options: {
18
      options: {
19
        // ajoute automatiquement des ";" entre les javascripts, au cas ou il en manque.
19
        // ajoute automatiquement des ";" entre les javascripts, au cas ou il en manque.
20
        separator: ';',
20
        separator: ';',
21
      },
21
      },
22
      dist: {
22
      dist: {
23
        src: ['bower_components/jquery/dist/jquery.min.js'],
23
        src: ['node_modules/jquery/dist/jquery.min.js'],
24
        dest: 'grunt_tests/built.js',
24
        dest: 'grunt_tests/built.js',
25
      },
25
      },
26
    },*/
26
    },*/
27
 
27
 
28
    /* Concatene et minifie les fichiers JS.*/
28
    /* Concatene et minifie les fichiers JS.*/
Line 31... Line 31...
31
        // mangle permet de renommer les variables JS.
31
        // mangle permet de renommer les variables JS.
32
        mangle: false
32
        mangle: false
33
      },
33
      },
34
      ASCIIMathML: {
34
      ASCIIMathML: {
35
        files: {
35
        files: {
36
          '../../scripts/js/ASCIIMathML.js': ['bower_components/asciimathml/ASCIIMathML.js']
36
          '../../scripts/js/ASCIIMathML.js': ['node_modules/asciimathml/ASCIIMathML.js']
37
        }
37
        }
38
      },
38
      },
39
      LaTeXMathML: {
39
      LaTeXMathML: {
40
        files: {
40
        files: {
41
          '../../scripts/js/LaTeXMathML.js': ['bower_components/asciimathml/LaTeXMathML.js']
41
          '../../scripts/js/LaTeXMathML.js': ['node_modules/asciimathml/LaTeXMathML.js']
42
        }
42
        }
43
      },
43
      },
44
      Geogebra: {
44
      Geogebra: {
45
        files: {
45
        files: {
46
          '../../scripts/js/geogebra/deployggb.min.js': ['../../scripts/js/geogebra/deployggb.js']
46
          '../../scripts/js/geogebra/deployggb.min.js': ['../../scripts/js/geogebra/deployggb.js']
47
        }
47
        }
48
      }
48
      }
49
    },
-
 
50
 
-
 
51
    // Compile les fichiers LESS en fichiers CSS
-
 
52
    less: {
-
 
53
      mbExtruder: {
-
 
54
        files: [{
-
 
55
            expand: true,
-
 
56
            cwd: "bower_components/jquery.mb.extruder/css",
-
 
57
            src: ["*.less"],
-
 
58
            dest: "bower_components/jquery.mb.extruder/css",
-
 
59
            ext: ".grunt.css",
-
 
60
        }]
-
 
61
        /*files: {
-
 
62
          "bower_components/jquery.mb.extruder/css/mbExtruder.grunt.css": "bower_components/jquery.mb.extruder/css/mbExtruder.less"
-
 
63
        },*/
-
 
64
      },
-
 
65
    },
49
    },
66
 
50
 
67
    // Concatene et minifie les fichiers CSS.
51
    // Concatene et minifie les fichiers CSS.
68
    cssmin: {
52
    cssmin: {
69
      options: {
53
      options: {
70
        shorthandCompacting: true,
54
        shorthandCompacting: true,
71
        roundingPrecision: -1,
55
        roundingPrecision: -1,
72
        keepSpecialComments: "*",
56
        keepSpecialComments: "*",
73
        /*rebase: true /* change all paths inside css file */
57
        /*rebase: true /* change all paths inside css file */
74
      },
-
 
75
      mbExtruder: {
-
 
76
        files: {
-
 
77
          "../../scripts/js/bower_components/jquery.mb.extruder/css/mbExtruder.min.css": ["bower_components/jquery.mb.extruder/css/*.grunt.css"]
-
 
78
        }
-
 
79
      },
58
      },
80
      normalize: {
59
      normalize: {
81
        files: {
60
        files: {
82
          /*"../../scripts/js/bower_components/normalize.css": ["bower_components/normalize.css/*.css"]*/
-
 
83
          "../../scripts/js/bower_components/normalize.min.css": ["bower_components/normalize.css/*.css"]
61
          "../../scripts/js/external/normalize.min.css": ["node_modules/normalize.css/*.css"]
84
        }
62
        }
85
      }
63
      }
86
    },
64
    },
87
 
65
 
88
    // Copie les fichiers vers leur répertoire définitif
66
    // Copie les fichiers vers leur répertoire définitif
Line 92... Line 70...
92
          // includes all minified files within path "jquery/dist"
70
          // includes all minified files within path "jquery/dist"
93
          {
71
          {
94
           expand: true,
72
           expand: true,
95
           flatten: true,
73
           flatten: true,
96
           filter: 'isFile',
74
           filter: 'isFile',
97
           src: ['bower_components/jquery/dist/*.min.*'],
75
           src: ['node_modules/jquery/dist/*.min.*'],
98
           dest: '../../scripts/js/bower_components/jquery/'
76
           dest: '../../scripts/js/external/jquery/'
99
          },
-
 
100
 
-
 
101
          // includes all minified files within path "jquery-ui/"
-
 
102
          {
-
 
103
           expand: true,
-
 
104
           filter: 'isFile',
-
 
105
           src: ['bower_components/jquery-ui/*.min.*','bower_components/jquery-ui/ui/i18n/*.js'],
-
 
106
           dest: '../../scripts/js/'
-
 
107
          },
-
 
108
 
-
 
109
          // includes all minified files within path "jquery-ui-slider-pips/"
-
 
110
          {
-
 
111
           expand: true,
-
 
112
           filter: 'isFile',
-
 
113
           src: ['bower_components/jquery-ui-slider-pips/dist/*.min.*'],
-
 
114
           dest: '../../scripts/js/'
-
 
115
          },
77
          },
116
 
78
 
-
 
79
          /*** JQuery UI ***/
117
          // includes all files & sub-directories within paths "jquery-ui/themes/smoothness" and "jquery-ui/themes/base"
80
          // includes all minified files within path "components-jqueryui/"
-
 
81
          {
-
 
82
           expand: true,
-
 
83
           flatten: true,
-
 
84
           src: ['node_modules/components-jqueryui/*.min.*'],
-
 
85
           dest: '../../scripts/js/external/jquery-ui/'
-
 
86
          },
-
 
87
          // includes all translated files for jquery-ui"
-
 
88
          {
-
 
89
           expand: true,
-
 
90
           flatten: true,
-
 
91
           src: ['node_modules/components-jqueryui/ui/i18n/*.js'],
-
 
92
           dest: '../../scripts/js/external/jquery-ui/ui/i18n/'
-
 
93
          },
-
 
94
          // includes smoothness theme for jquery-ui"
-
 
95
          {
-
 
96
           expand: true,
-
 
97
           flatten: true,
-
 
98
           src: ['node_modules/components-jqueryui/themes/smoothness/*.min.css'],
-
 
99
           dest: '../../scripts/js/external/jquery-ui/themes/smoothness/'
-
 
100
          },
-
 
101
          // includes smoothness images for jquery-ui"
-
 
102
          {
-
 
103
           expand: true,
-
 
104
           flatten: true,
-
 
105
           src: ['node_modules/components-jqueryui/themes/smoothness/images/*'],
-
 
106
           dest: '../../scripts/js/external/jquery-ui/themes/smoothness/images/'
-
 
107
          },
-
 
108
          // includes "base" theme for jquery-ui"
-
 
109
          {
-
 
110
           expand: true,
-
 
111
           flatten: true,
-
 
112
           src: ['node_modules/components-jqueryui/themes/base/*.min.css'],
-
 
113
           dest: '../../scripts/js/external/jquery-ui/themes/base/'
-
 
114
          },
-
 
115
          // includes "base" images for jquery-ui"
118
          {
116
          {
119
           expand: true,
117
           expand: true,
-
 
118
           flatten: true,
120
           src: ['bower_components/jquery-ui/themes/smoothness/**','bower_components/jquery-ui/themes/base/**'],
119
           src: ['node_modules/components-jqueryui/themes/base/images/*'],
121
           dest: '../../scripts/js/'
120
           dest: '../../scripts/js/external/jquery-ui/themes/base/images/'
122
          },
121
          },
123
 
-
 
124
          // safari_mobile_links
122
          // includes all minified files within path "jquery-ui-slider-pips/"
125
          {
123
          {
126
            expand: true,
124
           expand: true,
127
            filter: 'isFile',
125
           flatten: true,
128
            src: ['bower_components/safari_mobile_links/compressed.js'],
126
           src: ['node_modules/jquery-ui-slider-pips/dist/*.min.*'],
129
            dest: '../../scripts/js/',
127
           dest: '../../scripts/js/external/jquery-ui-slider-pips/'
130
          },
128
          },
131
 
129
 
132
          // mbExtruder (including mb.flipText)
130
          // safari_mobile_links
133
          {
131
          /*{
134
            expand: true,
132
            expand: true,
-
 
133
            filter: 'isFile',
135
            src: ['bower_components/jquery.mb.extruder/inc/*.js', 'bower_components/jquery.mb.extruder/elements/*' ],
134
            src: ['node_modules/safari_mobile_links/compressed.js'],
136
            dest: '../../scripts/js/',
135
            dest: '../../scripts/js/external/safari_mobile_links/',
137
          },
136
          },*/
-
 
137
 
138
          // hoverIntent
138
          // hoverIntent
139
          {
139
          {
140
            expand: true,
140
            expand: true,
-
 
141
            flatten: true,
141
            filter: 'isFile',
142
            filter: 'isFile',
142
            src: ['bower_components/jquery-hoverIntent/*.js' ],
143
            src: ['node_modules/jquery-hoverIntent/*.min.js'],
143
            dest: '../../scripts/js/',
144
            dest: '../../scripts/js/external/hoverIntent/',
144
          },
145
          },
145
          // what-input
146
          // what-input
146
          {
147
          {
147
            expand: true,
148
            expand: true,
-
 
149
            flatten: true,
148
            filter: 'isFile',
150
            filter: 'isFile',
149
            src: ['bower_components/what-input/dist/*.min.js' ],
151
            src: ['node_modules/what-input/dist/*.min.js'],
150
            dest: '../../scripts/js/',
152
            dest: '../../scripts/js/external/what-input/',
151
          },
153
          },
152
          // Chart.js
154
          // Chart.js
153
          {
155
          {
154
            expand: true,
156
            expand: true,
-
 
157
            flatten: true,
155
            filter: 'isFile',
158
            filter: 'isFile',
156
            src: ['bower_components/Chart.js/dist/*.bundle.min.js' ],
159
            src: ['node_modules/chart.js/dist/*.bundle.min.js'],
157
            dest: '../../scripts/js/',
160
            dest: '../../scripts/js/external/chart.js/',
158
          },
161
          },
159
          // jsxGraph
162
          // jsxGraph
160
          {
163
          {
161
            expand: true,
164
            expand: true,
162
            filter: 'isFile',
165
            filter: 'isFile',
163
            flatten: 'true',
166
            flatten: 'true',
164
            src: ['bower_components/jsxgraph/distrib/jsxgraph*', 'bower_components/jsxgraph/distrib/geo*' ],
167
            src: ['node_modules/jsxgraph/distrib/jsxgraph*', 'node_modules/jsxgraph/distrib/geo*'],
165
            //dest: '../../scripts/js/bower_components/jsxgraph/',
168
            //dest: '../../scripts/js/external/jsxgraph/',
166
            dest: '../../scripts/js/jsxgraph/',
169
            dest: '../../scripts/js/jsxgraph/',
167
          },
170
          },
-
 
171
          // Slideout.js
-
 
172
          /*{
-
 
173
            expand: true,
-
 
174
            filter: 'isFile',
-
 
175
            flatten: 'true',
-
 
176
            src: ['node_modules/slideout.js/dist/*.min.js', 'node_modules/slideout.js/*.css' ],
-
 
177
            dest: '../../scripts/js/slideout/',
-
 
178
          },*/
168
          /* ASCIIMathML (+LaTeXMathML)
179
          /* ASCIIMathML (+LaTeXMathML)
169
          {
180
          {
170
            expand: true,
181
            expand: true,
171
            flatten: true,
182
            flatten: true,
172
            filter: 'isFile',
183
            filter: 'isFile',
173
            src: ['bower_components/asciimathml/*.js' ],
184
            src: ['node_modules/asciimathml/*.js' ],
174
            dest: '../../scripts/js/',
185
            dest: '../../scripts/js/',
175
          },*/
186
          },*/
176
 
187
 
177
        ],
188
        ],
178
      },
189
      },
179
 
190
 
180
      // MathJax specific copying task (it could be long)
191
      // MathJax specific copying task (it could be long)
181
      MathJax: {
192
      /*MathJax: {
182
        files: [
193
        files: [
183
          {
194
          {
184
            expand: true,
195
            expand: true,
185
            src: ['bower_components/MathJax/**' ],
196
            src: ['node_modules/MathJax/**' ],
186
            dest: '../../scripts/js/',
197
            dest: '../../scripts/js/',
187
          },
198
          },
188
        ],
199
        ],
189
      },
200
      },*/
190
    },
201
    },
191
 
202
 
192
    // RSYNC
203
    // RSYNC
193
    rsync: {
204
    /*rsync: {
194
      options: {
205
      options: {
195
          args: ["--verbose"],
206
          args: ["--verbose"],
196
          exclude: [".git*","*.scss","node_modules"],
207
          exclude: [".git*","*.scss","node_modules"],
197
          recursive: true
208
          recursive: true
198
      },
209
      },
199
      MathJax: {
210
      MathJax: {
200
          options: {
211
          options: {
201
              src: "./bower_components/MathJax/",
212
              src: "./node_modules/MathJax/",
202
              dest: "../../scripts/js/mathjax"
213
              dest: "../../scripts/js/mathjax"
203
          }
214
          }
204
      }
215
      }
205
    }
216
    }*/
206
 
217
 
207
  });
218
  });
208
 
219
 
209
  /* available jobs */
220
  /* available jobs */
210
  grunt.loadNpmTasks('grunt-contrib-jshint');
221
  grunt.loadNpmTasks('grunt-eslint');
211
  /*grunt.loadNpmTasks('grunt-contrib-concat');*/
222
  /*grunt.loadNpmTasks('grunt-contrib-concat');*/
212
  grunt.loadNpmTasks('grunt-contrib-uglify');
223
  grunt.loadNpmTasks('grunt-contrib-uglify');
213
  grunt.loadNpmTasks('grunt-contrib-less');
-
 
214
  grunt.loadNpmTasks('grunt-contrib-cssmin');
224
  grunt.loadNpmTasks('grunt-contrib-cssmin');
215
  grunt.loadNpmTasks('grunt-contrib-copy');
225
  grunt.loadNpmTasks('grunt-contrib-copy');
216
  grunt.loadNpmTasks("grunt-rsync")
226
  //grunt.loadNpmTasks("grunt-rsync");
217
 
227
 
218
  /* Defined Tasks */
228
  /* Defined Tasks */
219
  grunt.registerTask('default', ['jshint', 'uglify', 'less', 'cssmin', 'copy:main'])
229
  grunt.registerTask('default', ['eslint', 'uglify', 'cssmin', 'copy:main']);
220
  //grunt.registerTask('mathjax', ['copy:MathJax'])
230
  //grunt.registerTask('mathjax', ['copy:MathJax']);
221
  grunt.registerTask('mathjax', ['rsync:MathJax'])
231
  grunt.registerTask('mathjax', ['rsync:MathJax']);
222
 
232
 
223
}
233
};