grunt.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. module.exports = function(grunt) {
  2. // Project configuration.
  3. grunt.initConfig({
  4. pkg: '<json:packages/lungo/component.json>',
  5. meta: {
  6. file: "lungo",
  7. banner: '/* <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("yyyy/m/d") %>\n' +
  8. ' <%= pkg.homepage %>\n' +
  9. ' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>' +
  10. ' - Licensed <%= _.pluck(pkg.license, "type").join(", ") %> */'
  11. },
  12. resources: {
  13. core: ['src/Lungo.js'],
  14. modules: [
  15. 'src/modules/*.js',
  16. 'src/boot/*.js',
  17. 'src/data/*.js',
  18. 'src/element/*.js',
  19. 'src/router/Lungo.Router.js', 'src/router/Lungo.Router.History.js',
  20. 'src/view/*.js'],
  21. device: ['src/device/*.js'],
  22. javascripts: ['src/**/*.js'],
  23. stylesheets: ['src/**/*.styl']
  24. },
  25. stylus: {
  26. compile: {
  27. options: { compress: true, paths: ['src/stylesheets/import'] },
  28. files: {
  29. 'packages/<%=meta.file%>/<%=meta.file%>.css': ['src/**/Lungo.*.styl']
  30. }
  31. },
  32. flatten: {
  33. options: { flatten: true },
  34. files: {
  35. 'packages/lungo/**.css': ['src/**/theme**.styl']
  36. }
  37. }
  38. },
  39. concat: {
  40. js: {
  41. src: ['<banner>', '<config:resources.core>', '<config:resources.modules>'],
  42. dest: 'build/<%=meta.file%>.js'
  43. },
  44. device: {
  45. src: ['<banner>', '<config:resources.device>'],
  46. dest: 'build/<%=meta.file%>.device.js'
  47. }
  48. },
  49. min: {
  50. js: {
  51. src: ['<banner>', 'build/<%=meta.file%>.js'],
  52. dest: 'packages/<%=meta.file%>/<%=meta.file%>.js'
  53. }
  54. },
  55. watch: {
  56. files: ['<config:resources.javascripts>', '<config:resources.stylesheets>'],
  57. tasks: 'concat min stylus'
  58. }
  59. });
  60. grunt.loadNpmTasks('grunt-contrib-stylus');
  61. // Default task.
  62. grunt.registerTask('default', 'concat min stylus');
  63. };