Subversion Repositories wimsdev

Rev

Rev 16497 | 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.         output: {
  34.           // preserve comments
  35.           comments: '/==============/'
  36.         }
  37.       },
  38.       ASCIIMathML: {
  39.         files: {
  40.           '../../scripts/js/ASCIIMathML.js': ['node_modules/asciimathml/ASCIIMathML.js']
  41.         }
  42.       },
  43.       LaTeXMathML: {
  44.         files: {
  45.           '../../scripts/js/LaTeXMathML.js': ['node_modules/asciimathml/LaTeXMathML.js']
  46.         }
  47.       },
  48.       Geogebra: {
  49.         files: {
  50.           '../../scripts/js/geogebra/deployggb.min.js': ['../../scripts/js/geogebra/deployggb.js']
  51.         }
  52.       }
  53.     },
  54.  
  55.     // Concatene et minifie les fichiers CSS.
  56.     cssmin: {
  57.       options: {
  58.         shorthandCompacting: true,
  59.         roundingPrecision: -1,
  60.         keepSpecialComments: "*",
  61.         /*rebase: true /* change all paths inside css file */
  62.       },
  63.       normalize: {
  64.         files: {
  65.           "../../scripts/js/external/normalize.min.css": ["node_modules/normalize.css/*.css"]
  66.         }
  67.       },
  68.       /*carousel:{
  69.         files: {
  70.           "../../scripts/js/external/slick/slick.min.css": ["node_modules/@accessible360/accessible-slick/slick/slick.scss"]
  71.         }
  72.       }*/
  73.     },
  74.  
  75.     // Copie les fichiers vers leur répertoire définitif
  76.     copy: {
  77.       main: {
  78.         files: [
  79.           // includes all minified files within path "jquery/dist"
  80.           {
  81.            expand: true,
  82.            flatten: true,
  83.            filter: 'isFile',
  84.            src: ['node_modules/jquery/dist/*.min.*'],
  85.            dest: '../../scripts/js/external/jquery/'
  86.           },
  87.  
  88.           /*** JQuery UI ***/
  89.           // includes all minified files within path "jquery-ui/"
  90.           {
  91.            expand: true,
  92.            flatten: true,
  93.            src: ['node_modules/jquery-ui-dist/*.min.*'],
  94.            dest: '../../scripts/js/external/jquery-ui/'
  95.           },
  96.           // includes all translated files for jquery-ui"
  97.           {
  98.            expand: true,
  99.            flatten: true,
  100.            src: ['node_modules/jquery-ui/ui/i18n/*.js'],
  101.            dest: '../../scripts/js/external/jquery-ui/ui/i18n/'
  102.           },
  103.           // includes smoothness theme for jquery-ui"
  104.           {
  105.            expand: true,
  106.            flatten: true,
  107.            src: ['node_modules/jquery-ui/themes/smoothness/*.min.css'],
  108.            dest: '../../scripts/js/external/jquery-ui/themes/smoothness/'
  109.           },
  110.           // includes smoothness images for jquery-ui"
  111.           {
  112.            expand: true,
  113.            flatten: true,
  114.            src: ['node_modules/jquery-ui/themes/smoothness/images/*'],
  115.            dest: '../../scripts/js/external/jquery-ui/themes/smoothness/images/'
  116.           },
  117.           // includes "base" theme for jquery-ui"
  118.           {
  119.            expand: true,
  120.            flatten: true,
  121.            src: ['node_modules/jquery-ui/themes/base/*.min.css'],
  122.            dest: '../../scripts/js/external/jquery-ui/themes/base/'
  123.           },
  124.           // includes "base" images for jquery-ui"
  125.           {
  126.            expand: true,
  127.            flatten: true,
  128.            src: ['node_modules/jquery-ui/themes/base/images/*'],
  129.            dest: '../../scripts/js/external/jquery-ui/themes/base/images/'
  130.           },
  131.           // includes all minified files within path "jquery-ui-slider-pips/"
  132.           {
  133.            expand: true,
  134.            flatten: true,
  135.            src: ['node_modules/jquery-ui-slider-pips/dist/*.min.*'],
  136.            dest: '../../scripts/js/external/jquery-ui-slider-pips/'
  137.           },
  138.  
  139.           // safari_mobile_links
  140.           /*{
  141.             expand: true,
  142.             filter: 'isFile',
  143.             src: ['node_modules/safari_mobile_links/compressed.js'],
  144.             dest: '../../scripts/js/external/safari_mobile_links/',
  145.           },*/
  146.  
  147.           /* hoverIntent
  148.           {
  149.             expand: true,
  150.             flatten: true,
  151.             filter: 'isFile',
  152.             src: ['node_modules/jquery-hoverIntent/*.min.js'],
  153.             dest: '../../scripts/js/external/hoverIntent/',
  154.           },*/
  155.           // what-input
  156.           {
  157.             expand: true,
  158.             flatten: true,
  159.             filter: 'isFile',
  160.             src: ['node_modules/what-input/dist/*.min.*'],
  161.             dest: '../../scripts/js/external/what-input/',
  162.           },
  163.           // Chart.js
  164.           {
  165.             expand: true,
  166.             flatten: true,
  167.             filter: 'isFile',
  168.             src: ['node_modules/chart.js/dist/*.umd.js'],
  169.             dest: '../../scripts/js/external/chart.js/',
  170.           },
  171.           // jsxGraph
  172.           {
  173.             expand: true,
  174.             filter: 'isFile',
  175.             flatten: 'true',
  176.             src: ['node_modules/jsxgraph/distrib/jsxgraph*', 'node_modules/jsxgraph/distrib/geo*'],
  177.             //dest: '../../scripts/js/external/jsxgraph/',
  178.             dest: '../../scripts/js/jsxgraph/',
  179.           },
  180.           // Slick Carousel
  181.           {
  182.             expand: true,
  183.             filter: 'isFile',
  184.             flatten: 'true',
  185.             src: ['node_modules/@accessible360/accessible-slick/slick/*.min.js','node_modules/@accessible360/accessible-slick/slick/*.gif','node_modules/@accessible360/accessible-slick/slick/*.css'],
  186.             dest: '../../scripts/js/external/slick/',
  187.             // ici il faudrait faire un rename du theme slick accessible en "slick-theme" tout court.
  188.           },{
  189.             expand: true,
  190.             filter: 'isFile',
  191.             flatten: 'true',
  192.             src: ['node_modules/@accessible360/accessible-slick/slick/fonts/*'],
  193.             dest: '../../scripts/js/external/slick/fonts/',
  194.           },
  195.           // Slideout.js
  196.           /*{
  197.             expand: true,
  198.             filter: 'isFile',
  199.             flatten: 'true',
  200.             src: ['node_modules/slideout.js/dist/*.min.js', 'node_modules/slideout.js/*.css' ],
  201.             dest: '../../scripts/js/slideout/',
  202.           },*/
  203.           /* ASCIIMathML (+LaTeXMathML)
  204.           {
  205.             expand: true,
  206.             flatten: true,
  207.             filter: 'isFile',
  208.             src: ['node_modules/asciimathml/*.js' ],
  209.             dest: '../../scripts/js/',
  210.           },*/
  211.           /* Marked js (Markdown parser) */
  212.           {
  213.             expand: true,
  214.             flatten: true,
  215.             filter: 'isFile',
  216.             src: ['node_modules/marked/*.js'],
  217.             dest: '../../scripts/js/external/marked/',
  218.           }
  219.  
  220.         ],
  221.       },
  222.  
  223.       // MathJax specific copying task (it could be long)
  224.       /*MathJax: {
  225.         files: [
  226.           {
  227.             expand: true,
  228.             src: ['node_modules/MathJax/**' ],
  229.             dest: '../../scripts/js/',
  230.           },
  231.         ],
  232.       },*/
  233.     },
  234.  
  235.     // RSYNC
  236.     /*rsync: {
  237.       options: {
  238.           args: ["--verbose"],
  239.           exclude: [".git*","*.scss","node_modules"],
  240.           recursive: true
  241.       },
  242.       MathJax: {
  243.           options: {
  244.               src: "./node_modules/MathJax/",
  245.               dest: "../../scripts/js/mathjax"
  246.           }
  247.       }
  248.     }*/
  249.  
  250.   });
  251.  
  252.   /* available jobs */
  253.   grunt.loadNpmTasks('grunt-eslint');
  254.   /*grunt.loadNpmTasks('grunt-contrib-concat');*/
  255.   grunt.loadNpmTasks('grunt-contrib-uglify');
  256.   grunt.loadNpmTasks('grunt-contrib-cssmin');
  257.   grunt.loadNpmTasks('grunt-contrib-copy');
  258.   //grunt.loadNpmTasks("grunt-rsync");
  259.  
  260.   /* Defined Tasks */
  261.   grunt.registerTask('default', ['eslint', 'uglify', 'cssmin', 'copy:main']);
  262.   //grunt.registerTask('mathjax', ['copy:MathJax']);
  263.   grunt.registerTask('mathjax', ['rsync:MathJax']);
  264.  
  265. };
  266.