Rev 10963 | Rev 13570 | 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.) |
||
6 | jshint: { |
||
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: { |
||
23 | src: ['bower_components/jquery/dist/jquery.min.js'], |
||
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: { |
10445 | obado | 36 | '../../scripts/js/ASCIIMathML.js': ['bower_components/asciimathml/ASCIIMathML.js'] |
9886 | obado | 37 | } |
10445 | obado | 38 | }, |
39 | LaTeXMathML: { |
||
40 | files: { |
||
41 | '../../scripts/js/LaTeXMathML.js': ['bower_components/asciimathml/LaTeXMathML.js'] |
||
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 | // 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 | }, |
||
66 | |||
67 | // Concatene et minifie les fichiers CSS. |
||
68 | cssmin: { |
||
69 | options: { |
||
70 | shorthandCompacting: true, |
||
71 | roundingPrecision: -1, |
||
72 | keepSpecialComments: "*", |
||
73 | /*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 | }, |
||
80 | normalize: { |
||
81 | files: { |
||
10445 | obado | 82 | /*"../../scripts/js/bower_components/normalize.css": ["bower_components/normalize.css/*.css"]*/ |
10451 | obado | 83 | "../../scripts/js/bower_components/normalize.min.css": ["bower_components/normalize.css/*.css"] |
9886 | obado | 84 | } |
85 | } |
||
86 | }, |
||
87 | |||
88 | // Copie les fichiers vers leur répertoire définitif |
||
89 | copy: { |
||
90 | main: { |
||
91 | files: [ |
||
92 | // includes all minified files within path "jquery/dist" |
||
93 | { |
||
94 | expand: true, |
||
95 | flatten: true, |
||
96 | filter: 'isFile', |
||
97 | src: ['bower_components/jquery/dist/*.min.*'], |
||
98 | dest: '../../scripts/js/bower_components/jquery/' |
||
99 | }, |
||
100 | |||
101 | // includes all minified files within path "jquery-ui/" |
||
102 | { |
||
103 | expand: true, |
||
104 | filter: 'isFile', |
||
11729 | obado | 105 | src: ['bower_components/jquery-ui/*.min.*','bower_components/jquery-ui/ui/i18n/*.js'], |
9886 | obado | 106 | dest: '../../scripts/js/' |
107 | }, |
||
108 | |||
10963 | obado | 109 | // includes all minified files within path "jquery-ui-slider-pips/" |
9886 | obado | 110 | { |
111 | expand: true, |
||
10963 | obado | 112 | filter: 'isFile', |
113 | src: ['bower_components/jquery-ui-slider-pips/dist/*.min.*'], |
||
9886 | obado | 114 | dest: '../../scripts/js/' |
115 | }, |
||
116 | |||
10963 | obado | 117 | // includes all files & sub-directories within paths "jquery-ui/themes/smoothness" and "jquery-ui/themes/base" |
118 | { |
||
119 | expand: true, |
||
120 | src: ['bower_components/jquery-ui/themes/smoothness/**','bower_components/jquery-ui/themes/base/**'], |
||
121 | dest: '../../scripts/js/' |
||
122 | }, |
||
123 | |||
9886 | obado | 124 | // safari_mobile_links |
125 | { |
||
126 | expand: true, |
||
127 | filter: 'isFile', |
||
128 | src: ['bower_components/safari_mobile_links/compressed.js'], |
||
129 | dest: '../../scripts/js/', |
||
130 | }, |
||
131 | |||
132 | // mbExtruder (including mb.flipText) |
||
133 | { |
||
134 | expand: true, |
||
135 | src: ['bower_components/jquery.mb.extruder/inc/*.js', 'bower_components/jquery.mb.extruder/elements/*' ], |
||
136 | dest: '../../scripts/js/', |
||
137 | }, |
||
138 | // hoverIntent |
||
139 | { |
||
140 | expand: true, |
||
141 | filter: 'isFile', |
||
142 | src: ['bower_components/jquery-hoverIntent/*.js' ], |
||
143 | dest: '../../scripts/js/', |
||
144 | }, |
||
10726 | obado | 145 | // what-input |
146 | { |
||
147 | expand: true, |
||
148 | filter: 'isFile', |
||
149 | src: ['bower_components/what-input/dist/*.min.js' ], |
||
150 | dest: '../../scripts/js/', |
||
151 | }, |
||
152 | // Chart.js |
||
153 | { |
||
154 | expand: true, |
||
155 | filter: 'isFile', |
||
156 | src: ['bower_components/Chart.js/dist/*.bundle.min.js' ], |
||
157 | dest: '../../scripts/js/', |
||
158 | }, |
||
10963 | obado | 159 | // jsxGraph |
160 | { |
||
161 | expand: true, |
||
162 | filter: 'isFile', |
||
163 | flatten: 'true', |
||
164 | src: ['bower_components/jsxgraph/distrib/jsxgraph*', 'bower_components/jsxgraph/distrib/geo*' ], |
||
165 | //dest: '../../scripts/js/bower_components/jsxgraph/', |
||
166 | dest: '../../scripts/js/jsxgraph/', |
||
167 | }, |
||
10445 | obado | 168 | /* ASCIIMathML (+LaTeXMathML) |
9886 | obado | 169 | { |
170 | expand: true, |
||
171 | flatten: true, |
||
172 | filter: 'isFile', |
||
173 | src: ['bower_components/asciimathml/*.js' ], |
||
174 | dest: '../../scripts/js/', |
||
10445 | obado | 175 | },*/ |
9886 | obado | 176 | |
177 | ], |
||
178 | }, |
||
9957 | obado | 179 | |
10963 | obado | 180 | // MathJax specific copying task (it could be long) |
9957 | obado | 181 | MathJax: { |
182 | files: [ |
||
183 | { |
||
184 | expand: true, |
||
185 | src: ['bower_components/MathJax/**' ], |
||
186 | dest: '../../scripts/js/', |
||
187 | }, |
||
188 | ], |
||
189 | }, |
||
9886 | obado | 190 | }, |
191 | |||
11729 | obado | 192 | // RSYNC |
193 | rsync: { |
||
194 | options: { |
||
195 | args: ["--verbose"], |
||
196 | exclude: [".git*","*.scss","node_modules"], |
||
197 | recursive: true |
||
198 | }, |
||
199 | MathJax: { |
||
200 | options: { |
||
201 | src: "./bower_components/MathJax/", |
||
202 | dest: "../../scripts/js/mathjax" |
||
203 | } |
||
204 | } |
||
205 | } |
||
206 | |||
9886 | obado | 207 | }); |
208 | |||
9957 | obado | 209 | /* available jobs */ |
9886 | obado | 210 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
10445 | obado | 211 | /*grunt.loadNpmTasks('grunt-contrib-concat');*/ |
212 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
||
9886 | obado | 213 | grunt.loadNpmTasks('grunt-contrib-less'); |
214 | grunt.loadNpmTasks('grunt-contrib-cssmin'); |
||
215 | grunt.loadNpmTasks('grunt-contrib-copy'); |
||
11729 | obado | 216 | grunt.loadNpmTasks("grunt-rsync") |
9886 | obado | 217 | |
9957 | obado | 218 | /* Defined Tasks */ |
10445 | obado | 219 | grunt.registerTask('default', ['jshint', 'uglify', 'less', 'cssmin', 'copy:main']) |
11729 | obado | 220 | //grunt.registerTask('mathjax', ['copy:MathJax']) |
221 | grunt.registerTask('mathjax', ['rsync:MathJax']) |
||
9886 | obado | 222 | |
223 | } |