Rev 11729 | Rev 13572 | 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. |
||
32 | mangle: false |
||
33 | }, |
||
10445 | obado | 34 | ASCIIMathML: { |
9886 | obado | 35 | files: { |
13570 | obado | 36 | '../../scripts/js/ASCIIMathML.js': ['node_modules/asciimathml/ASCIIMathML.js'] |
9886 | obado | 37 | } |
10445 | obado | 38 | }, |
39 | LaTeXMathML: { |
||
40 | files: { |
||
13570 | obado | 41 | '../../scripts/js/LaTeXMathML.js': ['node_modules/asciimathml/LaTeXMathML.js'] |
10445 | obado | 42 | } |
10726 | obado | 43 | }, |
44 | Geogebra: { |
||
45 | files: { |
||
46 | '../../scripts/js/geogebra/deployggb.min.js': ['../../scripts/js/geogebra/deployggb.js'] |
||
47 | } |
||
9886 | obado | 48 | } |
10445 | obado | 49 | }, |
9886 | obado | 50 | |
51 | // Concatene et minifie les fichiers CSS. |
||
52 | cssmin: { |
||
53 | options: { |
||
54 | shorthandCompacting: true, |
||
55 | roundingPrecision: -1, |
||
56 | keepSpecialComments: "*", |
||
57 | /*rebase: true /* change all paths inside css file */ |
||
58 | }, |
||
59 | normalize: { |
||
60 | files: { |
||
13570 | obado | 61 | "../../scripts/js/external/normalize.min.css": ["node_modules/normalize.css/*.css"] |
9886 | obado | 62 | } |
63 | } |
||
64 | }, |
||
65 | |||
66 | // Copie les fichiers vers leur répertoire définitif |
||
67 | copy: { |
||
68 | main: { |
||
69 | files: [ |
||
70 | // includes all minified files within path "jquery/dist" |
||
71 | { |
||
72 | expand: true, |
||
73 | flatten: true, |
||
74 | filter: 'isFile', |
||
13570 | obado | 75 | src: ['node_modules/jquery/dist/*.min.*'], |
76 | dest: '../../scripts/js/external/jquery/' |
||
9886 | obado | 77 | }, |
78 | |||
13570 | obado | 79 | /*** JQuery UI ***/ |
80 | // includes all minified files within path "components-jqueryui/" |
||
9886 | obado | 81 | { |
82 | expand: true, |
||
13570 | obado | 83 | flatten: true, |
84 | src: ['node_modules/components-jqueryui/*.min.*'], |
||
85 | dest: '../../scripts/js/external/jquery-ui/' |
||
9886 | obado | 86 | }, |
13570 | obado | 87 | // includes all translated files for jquery-ui" |
9886 | obado | 88 | { |
89 | expand: true, |
||
13570 | obado | 90 | flatten: true, |
91 | src: ['node_modules/components-jqueryui/ui/i18n/*.js'], |
||
92 | dest: '../../scripts/js/external/jquery-ui/ui/i18n/' |
||
9886 | obado | 93 | }, |
13570 | obado | 94 | // includes smoothness theme for jquery-ui" |
10963 | obado | 95 | { |
96 | expand: true, |
||
13570 | obado | 97 | flatten: true, |
98 | src: ['node_modules/components-jqueryui/themes/smoothness/*.min.css'], |
||
99 | dest: '../../scripts/js/external/jquery-ui/themes/smoothness/' |
||
10963 | obado | 100 | }, |
13570 | obado | 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" |
||
116 | { |
||
117 | expand: true, |
||
118 | flatten: true, |
||
119 | src: ['node_modules/components-jqueryui/themes/base/images/*'], |
||
120 | dest: '../../scripts/js/external/jquery-ui/themes/base/images/' |
||
121 | }, |
||
122 | // includes all minified files within path "jquery-ui-slider-pips/" |
||
123 | { |
||
124 | expand: true, |
||
125 | flatten: true, |
||
126 | src: ['node_modules/jquery-ui-slider-pips/dist/*.min.*'], |
||
127 | dest: '../../scripts/js/external/jquery-ui-slider-pips/' |
||
128 | }, |
||
10963 | obado | 129 | |
9886 | obado | 130 | // safari_mobile_links |
13570 | obado | 131 | /*{ |
9886 | obado | 132 | expand: true, |
133 | filter: 'isFile', |
||
13570 | obado | 134 | src: ['node_modules/safari_mobile_links/compressed.js'], |
135 | dest: '../../scripts/js/external/safari_mobile_links/', |
||
136 | },*/ |
||
9886 | obado | 137 | |
138 | // hoverIntent |
||
139 | { |
||
140 | expand: true, |
||
13570 | obado | 141 | flatten: true, |
9886 | obado | 142 | filter: 'isFile', |
13570 | obado | 143 | src: ['node_modules/jquery-hoverIntent/*.min.js'], |
144 | dest: '../../scripts/js/external/hoverIntent/', |
||
9886 | obado | 145 | }, |
10726 | obado | 146 | // what-input |
147 | { |
||
148 | expand: true, |
||
13570 | obado | 149 | flatten: true, |
10726 | obado | 150 | filter: 'isFile', |
13570 | obado | 151 | src: ['node_modules/what-input/dist/*.min.js'], |
152 | dest: '../../scripts/js/external/what-input/', |
||
10726 | obado | 153 | }, |
154 | // Chart.js |
||
155 | { |
||
156 | expand: true, |
||
13570 | obado | 157 | flatten: true, |
10726 | obado | 158 | filter: 'isFile', |
13570 | obado | 159 | src: ['node_modules/chart.js/dist/*.bundle.min.js'], |
160 | dest: '../../scripts/js/external/chart.js/', |
||
10726 | obado | 161 | }, |
10963 | obado | 162 | // jsxGraph |
163 | { |
||
164 | expand: true, |
||
165 | filter: 'isFile', |
||
166 | flatten: 'true', |
||
13570 | obado | 167 | src: ['node_modules/jsxgraph/distrib/jsxgraph*', 'node_modules/jsxgraph/distrib/geo*'], |
168 | //dest: '../../scripts/js/external/jsxgraph/', |
||
10963 | obado | 169 | dest: '../../scripts/js/jsxgraph/', |
170 | }, |
||
13570 | obado | 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 | },*/ |
||
10445 | obado | 179 | /* ASCIIMathML (+LaTeXMathML) |
9886 | obado | 180 | { |
181 | expand: true, |
||
182 | flatten: true, |
||
183 | filter: 'isFile', |
||
13570 | obado | 184 | src: ['node_modules/asciimathml/*.js' ], |
9886 | obado | 185 | dest: '../../scripts/js/', |
10445 | obado | 186 | },*/ |
9886 | obado | 187 | |
188 | ], |
||
189 | }, |
||
9957 | obado | 190 | |
10963 | obado | 191 | // MathJax specific copying task (it could be long) |
13570 | obado | 192 | /*MathJax: { |
9957 | obado | 193 | files: [ |
194 | { |
||
195 | expand: true, |
||
13570 | obado | 196 | src: ['node_modules/MathJax/**' ], |
9957 | obado | 197 | dest: '../../scripts/js/', |
198 | }, |
||
199 | ], |
||
13570 | obado | 200 | },*/ |
9886 | obado | 201 | }, |
202 | |||
11729 | obado | 203 | // RSYNC |
13570 | obado | 204 | /*rsync: { |
11729 | obado | 205 | options: { |
206 | args: ["--verbose"], |
||
207 | exclude: [".git*","*.scss","node_modules"], |
||
208 | recursive: true |
||
209 | }, |
||
210 | MathJax: { |
||
211 | options: { |
||
13570 | obado | 212 | src: "./node_modules/MathJax/", |
11729 | obado | 213 | dest: "../../scripts/js/mathjax" |
214 | } |
||
215 | } |
||
13570 | obado | 216 | }*/ |
11729 | obado | 217 | |
9886 | obado | 218 | }); |
219 | |||
9957 | obado | 220 | /* available jobs */ |
13570 | obado | 221 | grunt.loadNpmTasks('grunt-eslint'); |
10445 | obado | 222 | /*grunt.loadNpmTasks('grunt-contrib-concat');*/ |
223 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
||
9886 | obado | 224 | grunt.loadNpmTasks('grunt-contrib-cssmin'); |
225 | grunt.loadNpmTasks('grunt-contrib-copy'); |
||
13570 | obado | 226 | //grunt.loadNpmTasks("grunt-rsync"); |
9886 | obado | 227 | |
9957 | obado | 228 | /* Defined Tasks */ |
13570 | obado | 229 | grunt.registerTask('default', ['eslint', 'uglify', 'cssmin', 'copy:main']); |
230 | //grunt.registerTask('mathjax', ['copy:MathJax']); |
||
231 | grunt.registerTask('mathjax', ['rsync:MathJax']); |
||
9886 | obado | 232 | |
13570 | obado | 233 | }; |