Gruntfile.coffee 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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"]
  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. expand: true
  34. src: "build/js/bootstrap-switch.js"
  35. ext: ".min.js"
  36. less:
  37. build:
  38. files:
  39. "build/css/bootstrap2/bootstrap-switch.css": "src/less/bootstrap2/bootstrap-switch.less"
  40. "build/css/bootstrap3/bootstrap-switch.css": "src/less/bootstrap3/bootstrap-switch.less"
  41. cssmin:
  42. build:
  43. expand: true
  44. src: ["build/css/bootstrap2/bootstrap-switch.css", "build/css/bootstrap3/bootstrap-switch.css"]
  45. ext: ".min.css"
  46. usebanner:
  47. options:
  48. banner: "/* ========================================================================\n" +
  49. " * <%= pkg.name %> - v<%= pkg.version %>\n" +
  50. " * <%= pkg.homepage %>\n" +
  51. " * ========================================================================\n" +
  52. " * Copyright 2012-2013 <%= pkg.author.name %>\n" +
  53. " *\n" +
  54. " * ========================================================================\n" +
  55. " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
  56. " * you may not use this file except in compliance with the License.\n" +
  57. " * You may obtain a copy of the License at\n" +
  58. " *\n" +
  59. " * http://www.apache.org/licenses/LICENSE-2.0\n" +
  60. " *\n" +
  61. " * Unless required by applicable law or agreed to in writing, software\n" +
  62. " * distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
  63. " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
  64. " * See the License for the specific language governing permissions and\n" +
  65. " * limitations under the License.\n" +
  66. " * ========================================================================\n" +
  67. " */\n"
  68. css:
  69. files:
  70. src: ["build/**/*.css"]
  71. js:
  72. files:
  73. src: ["build/**/*.js"]
  74. jshint:
  75. all: ["*.json"]
  76. clean:
  77. css: ["build/css"]
  78. js: ["build/js"]
  79. connect:
  80. go:
  81. options:
  82. port: 3000
  83. open:
  84. go:
  85. path: "http://localhost:<%= connect.go.options.port %>"
  86. bump:
  87. options:
  88. files: ["package.json", "bower.json"]
  89. commitFiles: ["-a"]
  90. push: false
  91. watch:
  92. coffee:
  93. files: ["src/**/*.coffee"]
  94. tasks: ["clean:js", "coffeelint", "coffee", "uglify", "usebanner:js"]
  95. less:
  96. files: ["src/**/*.less"],
  97. tasks: ["clean:css", "less", "cssmin", "usebanner:css"]
  98. grunt.registerTask "go", ["build", "connect", "open", "watch"]
  99. grunt.registerTask "build", ["clean", "coffeelint", "coffee", "uglify", "usebanner:js", "less", "cssmin", "usebanner:css"]