gruntfile.js 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. module.exports = function(grunt) {
  2. grunt.initConfig({
  3. pkg: grunt.file.readJSON('package.json'),
  4. concat: {
  5. options: {
  6. separator: ';'
  7. },
  8. dist: {
  9. src: ['js/searx_src/*.js'],
  10. dest: 'js/searx.js'
  11. }
  12. },
  13. uglify: {
  14. options: {
  15. banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
  16. },
  17. dist: {
  18. files: {
  19. 'js/searx.min.js': ['<%= concat.dist.dest %>']
  20. }
  21. }
  22. },
  23. jshint: {
  24. files: ['gruntfile.js', 'js/searx_src/*.js'],
  25. options: {
  26. // options here to override JSHint defaults
  27. globals: {
  28. jQuery: true,
  29. console: true,
  30. module: true,
  31. document: true
  32. }
  33. }
  34. },
  35. less: {
  36. development: {
  37. options: {
  38. paths: ["less/oscar"]
  39. //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
  40. },
  41. files: {"css/oscar.css": "less/oscar/oscar.less"}
  42. },
  43. production: {
  44. options: {
  45. paths: ["less/oscar"],
  46. //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n',
  47. cleancss: true
  48. },
  49. files: {"css/oscar.min.css": "less/oscar/oscar.less"}
  50. },
  51. bootstrap: {
  52. options: {
  53. paths: ["less/bootstrap"],
  54. cleancss: true
  55. },
  56. files: {"css/bootstrap.min.css": "less/bootstrap/bootstrap.less"}
  57. },
  58. },
  59. watch: {
  60. scripts: {
  61. files: ['<%= jshint.files %>'],
  62. tasks: ['jshint', 'concat', 'uglify']
  63. },
  64. oscar_styles: {
  65. files: ['less/oscar/**/*.less'],
  66. tasks: ['less:development', 'less:production']
  67. },
  68. bootstrap_styles: {
  69. files: ['less/bootstrap/**/*.less'],
  70. tasks: ['less:bootstrap']
  71. }
  72. }
  73. });
  74. grunt.loadNpmTasks('grunt-contrib-uglify');
  75. grunt.loadNpmTasks('grunt-contrib-jshint');
  76. grunt.loadNpmTasks('grunt-contrib-watch');
  77. grunt.loadNpmTasks('grunt-contrib-concat');
  78. grunt.loadNpmTasks('grunt-contrib-less');
  79. grunt.registerTask('test', ['jshint']);
  80. grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less']);
  81. grunt.registerTask('styles', ['less']);
  82. };