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