Subversion Repositories wimsdev

Rev

Rev 14730 | 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.       carousel:{
  69.         files: {
  70.           "../../scripts/js/external/slick/slick.min.css": ["node_modules/slick-carousel/slick/slick.css"]
  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/*.bundle.min.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/slick-carousel/slick/*.min.js','node_modules/slick-carousel/slick/*.gif','node_modules/slick-carousel/slick/*-theme.css'],
  186.             dest: '../../scripts/js/external/slick/',
  187.           },{
  188.             expand: true,
  189.             filter: 'isFile',
  190.             flatten: 'true',
  191.             src: ['node_modules/slick-carousel/slick/fonts/*'],
  192.             dest: '../../scripts/js/external/slick/fonts/',
  193.           },
  194.           // Slideout.js
  195.           /*{
  196.             expand: true,
  197.             filter: 'isFile',
  198.             flatten: 'true',
  199.             src: ['node_modules/slideout.js/dist/*.min.js', 'node_modules/slideout.js/*.css' ],
  200.             dest: '../../scripts/js/slideout/',
  201.           },*/
  202.           /* ASCIIMathML (+LaTeXMathML)
  203.           {
  204.             expand: true,
  205.             flatten: true,
  206.             filter: 'isFile',
  207.             src: ['node_modules/asciimathml/*.js' ],
  208.             dest: '../../scripts/js/',
  209.           },*/
  210.           /* Marked js (Markdown parser) */
  211.           {
  212.             expand: true,
  213.             flatten: true,
  214.             filter: 'isFile',
  215.             src: ['node_modules/marked/*.js' ],
  216.             dest: '../../scripts/js/external/marked/',
  217.           }
  218.  
  219.         ],
  220.       },
  221.  
  222.       // MathJax specific copying task (it could be long)
  223.       /*MathJax: {
  224.         files: [
  225.           {
  226.             expand: true,
  227.             src: ['node_modules/MathJax/**' ],
  228.             dest: '../../scripts/js/',
  229.           },
  230.         ],
  231.       },*/
  232.     },
  233.  
  234.     // RSYNC
  235.     /*rsync: {
  236.       options: {
  237.           args: ["--verbose"],
  238.           exclude: [".git*","*.scss","node_modules"],
  239.           recursive: true
  240.       },
  241.       MathJax: {
  242.           options: {
  243.               src: "./node_modules/MathJax/",
  244.               dest: "../../scripts/js/mathjax"
  245.           }
  246.       }
  247.     }*/
  248.  
  249.   });
  250.  
  251.   /* available jobs */
  252.   grunt.loadNpmTasks('grunt-eslint');
  253.   /*grunt.loadNpmTasks('grunt-contrib-concat');*/
  254.   grunt.loadNpmTasks('grunt-contrib-uglify');
  255.   grunt.loadNpmTasks('grunt-contrib-cssmin');
  256.   grunt.loadNpmTasks('grunt-contrib-copy');
  257.   //grunt.loadNpmTasks("grunt-rsync");
  258.  
  259.   /* Defined Tasks */
  260.   grunt.registerTask('default', ['eslint', 'uglify', 'cssmin', 'copy:main']);
  261.   //grunt.registerTask('mathjax', ['copy:MathJax']);
  262.   grunt.registerTask('mathjax', ['rsync:MathJax']);
  263.  
  264. };
  265.