Rev 10445 | Rev 10726 | 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'], |
10445 | obado | 12 | /*inc: ['../_inc/*.js'],*/ |
9886 | obado | 13 | }, |
14 | |||
15 | /* Concatene plusieurs fichiers en un seul |
||
16 | concat: { |
||
17 | options: { |
||
18 | // ajoute automatiquement des ";" entre les javascripts, au cas ou il en manque. |
||
19 | separator: ';', |
||
20 | }, |
||
21 | dist: { |
||
22 | src: ['bower_components/jquery/dist/jquery.min.js'], |
||
23 | dest: 'grunt_tests/built.js', |
||
24 | }, |
||
25 | },*/ |
||
26 | |||
10445 | obado | 27 | /* Concatene et minifie les fichiers JS.*/ |
9886 | obado | 28 | uglify: { |
29 | options: { |
||
30 | // mangle permet de renommer les variables JS. |
||
31 | mangle: false |
||
32 | }, |
||
10445 | obado | 33 | ASCIIMathML: { |
9886 | obado | 34 | files: { |
10445 | obado | 35 | '../../scripts/js/ASCIIMathML.js': ['bower_components/asciimathml/ASCIIMathML.js'] |
9886 | obado | 36 | } |
10445 | obado | 37 | }, |
38 | LaTeXMathML: { |
||
39 | files: { |
||
40 | '../../scripts/js/LaTeXMathML.js': ['bower_components/asciimathml/LaTeXMathML.js'] |
||
41 | } |
||
9886 | obado | 42 | } |
10445 | obado | 43 | }, |
9886 | obado | 44 | |
45 | // Compile les fichiers LESS en fichiers CSS |
||
46 | less: { |
||
47 | mbExtruder: { |
||
48 | files: [{ |
||
49 | expand: true, |
||
50 | cwd: "bower_components/jquery.mb.extruder/css", |
||
51 | src: ["*.less"], |
||
52 | dest: "bower_components/jquery.mb.extruder/css", |
||
53 | ext: ".grunt.css", |
||
54 | }] |
||
55 | /*files: { |
||
56 | "bower_components/jquery.mb.extruder/css/mbExtruder.grunt.css": "bower_components/jquery.mb.extruder/css/mbExtruder.less" |
||
57 | },*/ |
||
58 | }, |
||
59 | }, |
||
60 | |||
61 | // Concatene et minifie les fichiers CSS. |
||
62 | cssmin: { |
||
63 | options: { |
||
64 | shorthandCompacting: true, |
||
65 | roundingPrecision: -1, |
||
66 | keepSpecialComments: "*", |
||
67 | /*rebase: true /* change all paths inside css file */ |
||
68 | }, |
||
69 | mbExtruder: { |
||
70 | files: { |
||
71 | "../../scripts/js/bower_components/jquery.mb.extruder/css/mbExtruder.min.css": ["bower_components/jquery.mb.extruder/css/*.grunt.css"] |
||
72 | } |
||
73 | }, |
||
74 | normalize: { |
||
75 | files: { |
||
10445 | obado | 76 | /*"../../scripts/js/bower_components/normalize.css": ["bower_components/normalize.css/*.css"]*/ |
10451 | obado | 77 | "../../scripts/js/bower_components/normalize.min.css": ["bower_components/normalize.css/*.css"] |
9886 | obado | 78 | } |
79 | } |
||
80 | }, |
||
81 | |||
82 | // Copie les fichiers vers leur répertoire définitif |
||
83 | copy: { |
||
84 | main: { |
||
85 | files: [ |
||
86 | // includes all minified files within path "jquery/dist" |
||
87 | { |
||
88 | expand: true, |
||
89 | flatten: true, |
||
90 | filter: 'isFile', |
||
91 | src: ['bower_components/jquery/dist/*.min.*'], |
||
92 | dest: '../../scripts/js/bower_components/jquery/' |
||
93 | }, |
||
94 | |||
95 | // includes all minified files within path "jquery-ui/" |
||
96 | { |
||
97 | expand: true, |
||
98 | filter: 'isFile', |
||
99 | src: ['bower_components/jquery-ui/*.min.*'], |
||
100 | dest: '../../scripts/js/' |
||
101 | }, |
||
102 | |||
103 | // includes all files & sub-directories within path "jquery-ui/themes/smoothness" |
||
104 | { |
||
105 | expand: true, |
||
106 | src: ['bower_components/jquery-ui/themes/smoothness/**'], |
||
107 | dest: '../../scripts/js/' |
||
108 | }, |
||
109 | |||
110 | // safari_mobile_links |
||
111 | { |
||
112 | expand: true, |
||
113 | filter: 'isFile', |
||
114 | src: ['bower_components/safari_mobile_links/compressed.js'], |
||
115 | dest: '../../scripts/js/', |
||
116 | }, |
||
117 | |||
118 | // mbExtruder (including mb.flipText) |
||
119 | { |
||
120 | expand: true, |
||
121 | src: ['bower_components/jquery.mb.extruder/inc/*.js', 'bower_components/jquery.mb.extruder/elements/*' ], |
||
122 | dest: '../../scripts/js/', |
||
123 | }, |
||
124 | // hoverIntent |
||
125 | { |
||
126 | expand: true, |
||
127 | filter: 'isFile', |
||
128 | src: ['bower_components/jquery-hoverIntent/*.js' ], |
||
129 | dest: '../../scripts/js/', |
||
130 | }, |
||
10445 | obado | 131 | /* ASCIIMathML (+LaTeXMathML) |
9886 | obado | 132 | { |
133 | expand: true, |
||
134 | flatten: true, |
||
135 | filter: 'isFile', |
||
136 | src: ['bower_components/asciimathml/*.js' ], |
||
137 | dest: '../../scripts/js/', |
||
10445 | obado | 138 | },*/ |
9886 | obado | 139 | |
140 | ], |
||
141 | }, |
||
9957 | obado | 142 | |
143 | // MathJax specific copying task |
||
144 | MathJax: { |
||
145 | files: [ |
||
146 | { |
||
147 | expand: true, |
||
148 | src: ['bower_components/MathJax/**' ], |
||
149 | dest: '../../scripts/js/', |
||
150 | }, |
||
151 | ], |
||
152 | }, |
||
9886 | obado | 153 | }, |
154 | |||
155 | }); |
||
156 | |||
9957 | obado | 157 | /* available jobs */ |
9886 | obado | 158 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
10445 | obado | 159 | /*grunt.loadNpmTasks('grunt-contrib-concat');*/ |
160 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
||
9886 | obado | 161 | grunt.loadNpmTasks('grunt-contrib-less'); |
162 | grunt.loadNpmTasks('grunt-contrib-cssmin'); |
||
163 | grunt.loadNpmTasks('grunt-contrib-copy'); |
||
164 | |||
9957 | obado | 165 | /* Defined Tasks */ |
10445 | obado | 166 | grunt.registerTask('default', ['jshint', 'uglify', 'less', 'cssmin', 'copy:main']) |
9957 | obado | 167 | grunt.registerTask('MathJax', ['copy:MathJax']) |
9886 | obado | 168 | |
169 | } |