Gruntfile.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* global module:false */
  2. module.exports = function(grunt) {
  3. // Project configuration
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON('package.json'),
  6. meta: {
  7. banner:
  8. '/*!\n' +
  9. ' * Ladda <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
  10. ' * http://lab.hakim.se/ladda\n' +
  11. ' * MIT licensed\n' +
  12. ' *\n' +
  13. ' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
  14. ' */'
  15. },
  16. uglify: {
  17. main: {
  18. options: {
  19. banner: '<%= meta.banner %>\n'
  20. },
  21. files: {
  22. 'dist/ladda.min.js': 'js/ladda.js'
  23. }
  24. },
  25. lib: {
  26. options: {
  27. preserveComments: 'some'
  28. },
  29. files: {
  30. 'dist/spin.min.js': 'js/spin.js',
  31. 'dist/ladda.jquery.min.js': 'js/ladda.jquery.js'
  32. }
  33. }
  34. },
  35. sass: {
  36. main: {
  37. options: {
  38. style: 'compressed',
  39. sourcemap: 'none'
  40. },
  41. files: {
  42. 'dist/ladda.min.css': [ 'css/ladda-themed.scss' ],
  43. 'dist/ladda-themeless.min.css': [ 'css/ladda.scss' ]
  44. }
  45. }
  46. },
  47. jshint: {
  48. options: {
  49. curly: false,
  50. eqeqeq: true,
  51. immed: true,
  52. latedef: true,
  53. newcap: true,
  54. noarg: true,
  55. sub: true,
  56. undef: true,
  57. eqnull: true,
  58. browser: true,
  59. expr: true,
  60. loopfunc: true,
  61. globals: {
  62. head: false,
  63. module: false,
  64. console: false,
  65. define: false
  66. }
  67. },
  68. files: [ 'Gruntfile.js', 'js/ladda.js', 'js/ladda.jquery.js' ]
  69. },
  70. connect: {
  71. server: {
  72. options: {
  73. port: 8000,
  74. base: '.'
  75. }
  76. }
  77. },
  78. watch: {
  79. main: {
  80. files: [ 'Gruntfile.js', 'js/ladda.js' ],
  81. tasks: 'js'
  82. },
  83. theme: {
  84. files: [ 'css/ladda.scss' ],
  85. tasks: 'css'
  86. }
  87. }
  88. });
  89. // Dependencies
  90. grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  91. grunt.loadNpmTasks( 'grunt-contrib-uglify' );
  92. grunt.loadNpmTasks( 'grunt-contrib-watch' );
  93. grunt.loadNpmTasks( 'grunt-contrib-sass' );
  94. grunt.loadNpmTasks( 'grunt-contrib-connect' );
  95. // Default task
  96. grunt.registerTask( 'default', [ 'js', 'css' ] );
  97. // Theme task
  98. grunt.registerTask( 'js', [ 'jshint', 'uglify' ] );
  99. grunt.registerTask( 'css', [ 'sass' ] );
  100. // Serve presentation locally
  101. grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
  102. };