Gruntfile.coffee 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. "use strict"
  2. module.exports = (grunt) ->
  3. # load all grunt tasks
  4. require("matchdep").filterDev("grunt-*").forEach grunt.loadNpmTasks
  5. grunt.initConfig
  6. # load package json
  7. pkg: grunt.file.readJSON "package.json"
  8. coffeelint:
  9. options:
  10. arrow_spacing:
  11. level: "error"
  12. no_empty_param_list:
  13. level: "error"
  14. no_unnecessary_fat_arrows:
  15. level: "error"
  16. space_operators:
  17. level: "error"
  18. indentation:
  19. value: 2
  20. level: "error"
  21. max_line_length:
  22. level: "ignore"
  23. build: ["Gruntfile.coffee", "src/coffee/**/*.coffee"]
  24. coffee:
  25. build:
  26. expand: true
  27. cwd: "src/coffee"
  28. src: "**/*.coffee"
  29. dest: "build/js"
  30. ext: ".js"
  31. uglify:
  32. build:
  33. preserveComments: "some"
  34. expand: true
  35. src: "build/js/bootstrap-switch.js"
  36. ext: ".min.js"
  37. less:
  38. build:
  39. files:
  40. "build/css/bootstrap2/bootstrap-switch.css": "src/less/bootstrap2/bootstrap-switch.less"
  41. "build/css/bootstrap3/bootstrap-switch.css": "src/less/bootstrap3/bootstrap-switch.less"
  42. cssmin:
  43. build:
  44. expand: true
  45. src: ["build/css/bootstrap2/bootstrap-switch.css", "build/css/bootstrap3/bootstrap-switch.css"]
  46. ext: ".min.css"
  47. usebanner:
  48. build:
  49. options:
  50. banner: "/* ========================================================================\n" +
  51. " * <%= pkg.name %> - v<%= pkg.version %>\n" +
  52. " * <%= pkg.homepage %>\n" +
  53. " * ========================================================================\n" +
  54. " * Copyright 2012-2013 <%= pkg.author.name %>\n" +
  55. " *\n" +
  56. " * ========================================================================\n" +
  57. " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
  58. " * you may not use this file except in compliance with the License.\n" +
  59. " * You may obtain a copy of the License at\n" +
  60. " *\n" +
  61. " * http://www.apache.org/licenses/LICENSE-2.0\n" +
  62. " *\n" +
  63. " * Unless required by applicable law or agreed to in writing, software\n" +
  64. " * distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
  65. " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
  66. " * See the License for the specific language governing permissions and\n" +
  67. " * limitations under the License.\n" +
  68. " * ========================================================================\n" +
  69. " */\n"
  70. files:
  71. src: ["build/**/*"]
  72. jshint:
  73. all: ["*.json"]
  74. bump:
  75. options:
  76. files: ["package.json", "bower.json"]
  77. commitFiles: ["-a"]
  78. push: false
  79. grunt.registerTask "build", ["coffeelint", "coffee", "uglify", "less", "cssmin", "usebanner"]