Subversion Repositories wimsdev

Rev

Rev 10726 | Rev 11729 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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'],*/
  10.       /*wz: ['../../scripts/js/wz*.js'],*/
  11.       interface: ['../../scripts/js/interface/*.js'],
  12.       /*geogebra: ['../../scripts/js/geogebra/*.js'],*/
  13.       /*inc: ['../_inc/*.js'],*/
  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.  
  28.     /* Concatene et minifie les fichiers JS.*/
  29.     uglify: {
  30.       options: {
  31.         // mangle permet de renommer les variables JS.
  32.         mangle: false
  33.       },
  34.       ASCIIMathML: {
  35.         files: {
  36.           '../../scripts/js/ASCIIMathML.js': ['bower_components/asciimathml/ASCIIMathML.js']
  37.         }
  38.       },
  39.       LaTeXMathML: {
  40.         files: {
  41.           '../../scripts/js/LaTeXMathML.js': ['bower_components/asciimathml/LaTeXMathML.js']
  42.         }
  43.       },
  44.       Geogebra: {
  45.         files: {
  46.           '../../scripts/js/geogebra/deployggb.min.js': ['../../scripts/js/geogebra/deployggb.js']
  47.         }
  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.     },
  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: {
  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"]
  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',
  105.            src: ['bower_components/jquery-ui/*.min.*'],
  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.           },
  116.  
  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.  
  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.           },
  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.           },
  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.           },
  168.           /* ASCIIMathML (+LaTeXMathML)
  169.           {
  170.             expand: true,
  171.             flatten: true,
  172.             filter: 'isFile',
  173.             src: ['bower_components/asciimathml/*.js' ],
  174.             dest: '../../scripts/js/',
  175.           },*/
  176.  
  177.         ],
  178.       },
  179.  
  180.       // MathJax specific copying task (it could be long)
  181.       MathJax: {
  182.         files: [
  183.           {
  184.             expand: true,
  185.             src: ['bower_components/MathJax/**' ],
  186.             dest: '../../scripts/js/',
  187.           },
  188.         ],
  189.       },
  190.     },
  191.  
  192.   });
  193.  
  194.   /* available jobs */
  195.   grunt.loadNpmTasks('grunt-contrib-jshint');
  196.   /*grunt.loadNpmTasks('grunt-contrib-concat');*/
  197.   grunt.loadNpmTasks('grunt-contrib-uglify');
  198.   grunt.loadNpmTasks('grunt-contrib-less');
  199.   grunt.loadNpmTasks('grunt-contrib-cssmin');
  200.   grunt.loadNpmTasks('grunt-contrib-copy');
  201.  
  202.   /* Defined Tasks */
  203.   grunt.registerTask('default', ['jshint', 'uglify', 'less', 'cssmin', 'copy:main'])
  204.   grunt.registerTask('MathJax', ['copy:MathJax'])
  205.  
  206. }