Subversion Repositories wimsdev

Rev

Rev 13577 | Rev 14456 | 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.         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.     },
  69.  
  70.     // Copie les fichiers vers leur répertoire définitif
  71.     copy: {
  72.       main: {
  73.         files: [
  74.           // includes all minified files within path "jquery/dist"
  75.           {
  76.            expand: true,
  77.            flatten: true,
  78.            filter: 'isFile',
  79.            src: ['node_modules/jquery/dist/*.min.*'],
  80.            dest: '../../scripts/js/external/jquery/'
  81.           },
  82.  
  83.           /*** JQuery UI ***/
  84.           // includes all minified files within path "components-jqueryui/"
  85.           {
  86.            expand: true,
  87.            flatten: true,
  88.            src: ['node_modules/components-jqueryui/*.min.*'],
  89.            dest: '../../scripts/js/external/jquery-ui/'
  90.           },
  91.           // includes all translated files for jquery-ui"
  92.           {
  93.            expand: true,
  94.            flatten: true,
  95.            src: ['node_modules/components-jqueryui/ui/i18n/*.js'],
  96.            dest: '../../scripts/js/external/jquery-ui/ui/i18n/'
  97.           },
  98.           // includes smoothness theme for jquery-ui"
  99.           {
  100.            expand: true,
  101.            flatten: true,
  102.            src: ['node_modules/components-jqueryui/themes/smoothness/*.min.css'],
  103.            dest: '../../scripts/js/external/jquery-ui/themes/smoothness/'
  104.           },
  105.           // includes smoothness images for jquery-ui"
  106.           {
  107.            expand: true,
  108.            flatten: true,
  109.            src: ['node_modules/components-jqueryui/themes/smoothness/images/*'],
  110.            dest: '../../scripts/js/external/jquery-ui/themes/smoothness/images/'
  111.           },
  112.           // includes "base" theme for jquery-ui"
  113.           {
  114.            expand: true,
  115.            flatten: true,
  116.            src: ['node_modules/components-jqueryui/themes/base/*.min.css'],
  117.            dest: '../../scripts/js/external/jquery-ui/themes/base/'
  118.           },
  119.           // includes "base" images for jquery-ui"
  120.           {
  121.            expand: true,
  122.            flatten: true,
  123.            src: ['node_modules/components-jqueryui/themes/base/images/*'],
  124.            dest: '../../scripts/js/external/jquery-ui/themes/base/images/'
  125.           },
  126.           // includes all minified files within path "jquery-ui-slider-pips/"
  127.           {
  128.            expand: true,
  129.            flatten: true,
  130.            src: ['node_modules/jquery-ui-slider-pips/dist/*.min.*'],
  131.            dest: '../../scripts/js/external/jquery-ui-slider-pips/'
  132.           },
  133.  
  134.           // safari_mobile_links
  135.           /*{
  136.             expand: true,
  137.             filter: 'isFile',
  138.             src: ['node_modules/safari_mobile_links/compressed.js'],
  139.             dest: '../../scripts/js/external/safari_mobile_links/',
  140.           },*/
  141.  
  142.           /* hoverIntent
  143.           {
  144.             expand: true,
  145.             flatten: true,
  146.             filter: 'isFile',
  147.             src: ['node_modules/jquery-hoverIntent/*.min.js'],
  148.             dest: '../../scripts/js/external/hoverIntent/',
  149.           },*/
  150.           // what-input
  151.           {
  152.             expand: true,
  153.             flatten: true,
  154.             filter: 'isFile',
  155.             src: ['node_modules/what-input/dist/*.min.js', 'node_modules/what-input/dist/maps/*.map'],
  156.             dest: '../../scripts/js/external/what-input/',
  157.           },
  158.           // Chart.js
  159.           {
  160.             expand: true,
  161.             flatten: true,
  162.             filter: 'isFile',
  163.             src: ['node_modules/chart.js/dist/*.bundle.min.js'],
  164.             dest: '../../scripts/js/external/chart.js/',
  165.           },
  166.           // jsxGraph
  167.           {
  168.             expand: true,
  169.             filter: 'isFile',
  170.             flatten: 'true',
  171.             src: ['node_modules/jsxgraph/distrib/jsxgraph*', 'node_modules/jsxgraph/distrib/geo*'],
  172.             //dest: '../../scripts/js/external/jsxgraph/',
  173.             dest: '../../scripts/js/jsxgraph/',
  174.           },
  175.           // Slideout.js
  176.           /*{
  177.             expand: true,
  178.             filter: 'isFile',
  179.             flatten: 'true',
  180.             src: ['node_modules/slideout.js/dist/*.min.js', 'node_modules/slideout.js/*.css' ],
  181.             dest: '../../scripts/js/slideout/',
  182.           },*/
  183.           /* ASCIIMathML (+LaTeXMathML)
  184.           {
  185.             expand: true,
  186.             flatten: true,
  187.             filter: 'isFile',
  188.             src: ['node_modules/asciimathml/*.js' ],
  189.             dest: '../../scripts/js/',
  190.           },*/
  191.  
  192.         ],
  193.       },
  194.  
  195.       // MathJax specific copying task (it could be long)
  196.       /*MathJax: {
  197.         files: [
  198.           {
  199.             expand: true,
  200.             src: ['node_modules/MathJax/**' ],
  201.             dest: '../../scripts/js/',
  202.           },
  203.         ],
  204.       },*/
  205.     },
  206.  
  207.     // RSYNC
  208.     /*rsync: {
  209.       options: {
  210.           args: ["--verbose"],
  211.           exclude: [".git*","*.scss","node_modules"],
  212.           recursive: true
  213.       },
  214.       MathJax: {
  215.           options: {
  216.               src: "./node_modules/MathJax/",
  217.               dest: "../../scripts/js/mathjax"
  218.           }
  219.       }
  220.     }*/
  221.  
  222.   });
  223.  
  224.   /* available jobs */
  225.   grunt.loadNpmTasks('grunt-eslint');
  226.   /*grunt.loadNpmTasks('grunt-contrib-concat');*/
  227.   grunt.loadNpmTasks('grunt-contrib-uglify');
  228.   grunt.loadNpmTasks('grunt-contrib-cssmin');
  229.   grunt.loadNpmTasks('grunt-contrib-copy');
  230.   //grunt.loadNpmTasks("grunt-rsync");
  231.  
  232.   /* Defined Tasks */
  233.   grunt.registerTask('default', ['eslint', 'uglify', 'cssmin', 'copy:main']);
  234.   //grunt.registerTask('mathjax', ['copy:MathJax']);
  235.   grunt.registerTask('mathjax', ['rsync:MathJax']);
  236.  
  237. };
  238.