Subversion Repositories wimsdev

Rev

Rev 11729 | Rev 13572 | 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.     eslint: {
  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: ['node_modules/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': ['node_modules/asciimathml/ASCIIMathML.js']
  37.         }
  38.       },
  39.       LaTeXMathML: {
  40.         files: {
  41.           '../../scripts/js/LaTeXMathML.js': ['node_modules/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.     // 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: {
  61.           "../../scripts/js/external/normalize.min.css": ["node_modules/normalize.css/*.css"]
  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',
  75.            src: ['node_modules/jquery/dist/*.min.*'],
  76.            dest: '../../scripts/js/external/jquery/'
  77.           },
  78.  
  79.           /*** JQuery UI ***/
  80.           // includes all minified files within path "components-jqueryui/"
  81.           {
  82.            expand: true,
  83.            flatten: true,
  84.            src: ['node_modules/components-jqueryui/*.min.*'],
  85.            dest: '../../scripts/js/external/jquery-ui/'
  86.           },
  87.           // includes all translated files for jquery-ui"
  88.           {
  89.            expand: true,
  90.            flatten: true,
  91.            src: ['node_modules/components-jqueryui/ui/i18n/*.js'],
  92.            dest: '../../scripts/js/external/jquery-ui/ui/i18n/'
  93.           },
  94.           // includes smoothness theme for jquery-ui"
  95.           {
  96.            expand: true,
  97.            flatten: true,
  98.            src: ['node_modules/components-jqueryui/themes/smoothness/*.min.css'],
  99.            dest: '../../scripts/js/external/jquery-ui/themes/smoothness/'
  100.           },
  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.           },
  129.  
  130.           // safari_mobile_links
  131.           /*{
  132.             expand: true,
  133.             filter: 'isFile',
  134.             src: ['node_modules/safari_mobile_links/compressed.js'],
  135.             dest: '../../scripts/js/external/safari_mobile_links/',
  136.           },*/
  137.  
  138.           // hoverIntent
  139.           {
  140.             expand: true,
  141.             flatten: true,
  142.             filter: 'isFile',
  143.             src: ['node_modules/jquery-hoverIntent/*.min.js'],
  144.             dest: '../../scripts/js/external/hoverIntent/',
  145.           },
  146.           // what-input
  147.           {
  148.             expand: true,
  149.             flatten: true,
  150.             filter: 'isFile',
  151.             src: ['node_modules/what-input/dist/*.min.js'],
  152.             dest: '../../scripts/js/external/what-input/',
  153.           },
  154.           // Chart.js
  155.           {
  156.             expand: true,
  157.             flatten: true,
  158.             filter: 'isFile',
  159.             src: ['node_modules/chart.js/dist/*.bundle.min.js'],
  160.             dest: '../../scripts/js/external/chart.js/',
  161.           },
  162.           // jsxGraph
  163.           {
  164.             expand: true,
  165.             filter: 'isFile',
  166.             flatten: 'true',
  167.             src: ['node_modules/jsxgraph/distrib/jsxgraph*', 'node_modules/jsxgraph/distrib/geo*'],
  168.             //dest: '../../scripts/js/external/jsxgraph/',
  169.             dest: '../../scripts/js/jsxgraph/',
  170.           },
  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.           },*/
  179.           /* ASCIIMathML (+LaTeXMathML)
  180.           {
  181.             expand: true,
  182.             flatten: true,
  183.             filter: 'isFile',
  184.             src: ['node_modules/asciimathml/*.js' ],
  185.             dest: '../../scripts/js/',
  186.           },*/
  187.  
  188.         ],
  189.       },
  190.  
  191.       // MathJax specific copying task (it could be long)
  192.       /*MathJax: {
  193.         files: [
  194.           {
  195.             expand: true,
  196.             src: ['node_modules/MathJax/**' ],
  197.             dest: '../../scripts/js/',
  198.           },
  199.         ],
  200.       },*/
  201.     },
  202.  
  203.     // RSYNC
  204.     /*rsync: {
  205.       options: {
  206.           args: ["--verbose"],
  207.           exclude: [".git*","*.scss","node_modules"],
  208.           recursive: true
  209.       },
  210.       MathJax: {
  211.           options: {
  212.               src: "./node_modules/MathJax/",
  213.               dest: "../../scripts/js/mathjax"
  214.           }
  215.       }
  216.     }*/
  217.  
  218.   });
  219.  
  220.   /* available jobs */
  221.   grunt.loadNpmTasks('grunt-eslint');
  222.   /*grunt.loadNpmTasks('grunt-contrib-concat');*/
  223.   grunt.loadNpmTasks('grunt-contrib-uglify');
  224.   grunt.loadNpmTasks('grunt-contrib-cssmin');
  225.   grunt.loadNpmTasks('grunt-contrib-copy');
  226.   //grunt.loadNpmTasks("grunt-rsync");
  227.  
  228.   /* Defined Tasks */
  229.   grunt.registerTask('default', ['eslint', 'uglify', 'cssmin', 'copy:main']);
  230.   //grunt.registerTask('mathjax', ['copy:MathJax']);
  231.   grunt.registerTask('mathjax', ['rsync:MathJax']);
  232.  
  233. };
  234.