Subversion Repositories wimsdev

Rev

Rev 9957 | Rev 10445 | 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.       inc: ['../_inc/*.js'],
  13.     },
  14.  
  15.     /* Concatene plusieurs fichiers en un seul
  16.     concat: {
  17.       options: {
  18.         // ajoute automatiquement des ";" entre les javascripts, au cas ou il en manque.
  19.         separator: ';',
  20.       },
  21.       dist: {
  22.         src: ['bower_components/jquery/dist/jquery.min.js'],
  23.         dest: 'grunt_tests/built.js',
  24.       },
  25.     },*/
  26.  
  27.     /* Concatene et minifie les fichiers JS.
  28.     uglify: {
  29.       options: {
  30.         // mangle permet de renommer les variables JS.
  31.         mangle: false
  32.       },
  33.       dist: {
  34.         files: {
  35.           'grunt_tests/built.min.js': ['grunt_tests/built.js', 'autre.js']
  36.         }
  37.       }
  38.     },*/
  39.  
  40.     // Compile les fichiers LESS en fichiers CSS
  41.     less: {
  42.       mbExtruder: {
  43.         files: [{
  44.             expand: true,
  45.             cwd: "bower_components/jquery.mb.extruder/css",
  46.             src: ["*.less"],
  47.             dest: "bower_components/jquery.mb.extruder/css",
  48.             ext: ".grunt.css",
  49.         }]
  50.         /*files: {
  51.           "bower_components/jquery.mb.extruder/css/mbExtruder.grunt.css": "bower_components/jquery.mb.extruder/css/mbExtruder.less"
  52.         },*/
  53.       },
  54.     },
  55.  
  56.     // Concatene et minifie les fichiers CSS.
  57.     cssmin: {
  58.       options: {
  59.         shorthandCompacting: true,
  60.         roundingPrecision: -1,
  61.         keepSpecialComments: "*",
  62.         /*rebase: true /* change all paths inside css file */
  63.       },
  64.       mbExtruder: {
  65.         files: {
  66.           "../../scripts/js/bower_components/jquery.mb.extruder/css/mbExtruder.min.css": ["bower_components/jquery.mb.extruder/css/*.grunt.css"]
  67.         }
  68.       },
  69.       normalize: {
  70.         files: {
  71.           "../../scripts/js/bower_components/normalize.css": ["bower_components/normalize.css/*.css"]
  72.         }
  73.       }
  74.     },
  75.  
  76.     // Copie les fichiers vers leur répertoire définitif
  77.     copy: {
  78.       main: {
  79.         files: [
  80.           // includes all minified files within path "jquery/dist"
  81.           {
  82.            expand: true,
  83.            flatten: true,
  84.            filter: 'isFile',
  85.            src: ['bower_components/jquery/dist/*.min.*'],
  86.            dest: '../../scripts/js/bower_components/jquery/'
  87.           },
  88.  
  89.           // includes all minified files within path "jquery-ui/"
  90.           {
  91.            expand: true,
  92.            filter: 'isFile',
  93.            src: ['bower_components/jquery-ui/*.min.*'],
  94.            dest: '../../scripts/js/'
  95.           },
  96.  
  97.           // includes all files & sub-directories within path "jquery-ui/themes/smoothness"
  98.           {
  99.            expand: true,
  100.            src: ['bower_components/jquery-ui/themes/smoothness/**'],
  101.            dest: '../../scripts/js/'
  102.           },
  103.  
  104.           // safari_mobile_links
  105.           {
  106.             expand: true,
  107.             filter: 'isFile',
  108.             src: ['bower_components/safari_mobile_links/compressed.js'],
  109.             dest: '../../scripts/js/',
  110.           },
  111.  
  112.           // mbExtruder (including mb.flipText)
  113.           {
  114.             expand: true,
  115.             src: ['bower_components/jquery.mb.extruder/inc/*.js', 'bower_components/jquery.mb.extruder/elements/*' ],
  116.             dest: '../../scripts/js/',
  117.           },
  118.           // hoverIntent
  119.           {
  120.             expand: true,
  121.             filter: 'isFile',
  122.             src: ['bower_components/jquery-hoverIntent/*.js' ],
  123.             dest: '../../scripts/js/',
  124.           },
  125.  
  126.           // ASCIIMathML (+LaTeXMathML)
  127.           {
  128.             expand: true,
  129.             flatten: true,
  130.             filter: 'isFile',
  131.             src: ['bower_components/asciimathml/*.js' ],
  132.             dest: '../../scripts/js/',
  133.           },
  134.  
  135.         ],
  136.       },
  137.  
  138.       // MathJax specific copying task
  139.       MathJax: {
  140.         files: [
  141.           {
  142.             expand: true,
  143.             src: ['bower_components/MathJax/**' ],
  144.             dest: '../../scripts/js/',
  145.           },
  146.         ],
  147.       },
  148.     },
  149.  
  150.   });
  151.  
  152.   /* available jobs */
  153.   grunt.loadNpmTasks('grunt-contrib-jshint');
  154.   /*grunt.loadNpmTasks('grunt-contrib-concat');
  155.   grunt.loadNpmTasks('grunt-contrib-uglify');*/
  156.   grunt.loadNpmTasks('grunt-contrib-less');
  157.   grunt.loadNpmTasks('grunt-contrib-cssmin');
  158.   grunt.loadNpmTasks('grunt-contrib-copy');
  159.  
  160.   /* Defined Tasks */
  161.   grunt.registerTask('default', ['jshint', 'less', 'cssmin', 'copy:main'])
  162.   grunt.registerTask('MathJax', ['copy:MathJax'])
  163.  
  164. }