grunt.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. coffeescripts: ['src/**/*.coffee'],
  14. core: ['build/src/Lungo.js'],
  15. modules: [
  16. 'build/src/modules/*.js',
  17. 'build/src/boot/*.js',
  18. 'build/src/data/*.js',
  19. 'build/src/element/*.js',
  20. 'build/src/router/Lungo.Router.js', 'build/src/router/Lungo.Router.History.js',
  21. 'build/src/view/*.js'],
  22. stylesheets: [
  23. 'src/**/lungo.base.styl',
  24. 'src/**/lungo.layout.styl',
  25. 'src/**/lungo.layout.*.styl',
  26. 'src/**/lungo.widgets.styl',
  27. 'src/**/lungo.widgets.*.styl',
  28. 'src/**/lungo.media.*.styl'],
  29. icons: ['src/**/lungo.icon**.styl'],
  30. themes: ['src/**/theme**.styl']
  31. },
  32. coffee: {
  33. lungo: {
  34. src: ['<config:resources.coffeescripts>'],
  35. dest: 'build',
  36. options: {
  37. bare: true,
  38. preserve_dirs: true
  39. }
  40. }
  41. },
  42. concat: {
  43. js: {
  44. src: ['<banner>', '<config:resources.core>', '<config:resources.modules>'],
  45. dest: 'build/<%=meta.file%>.js'
  46. }
  47. },
  48. min: {
  49. js: {
  50. src: ['<banner>', 'build/<%=meta.file%>.js'],
  51. dest: 'packages/<%=meta.file%>/<%=meta.file%>.js'
  52. }
  53. },
  54. stylus: {
  55. stylesheets: {
  56. options: { compress: true, paths: ['src/stylesheets/import'] },
  57. files: { 'packages/<%=meta.file%>/<%=meta.file%>.css': '<config:resources.stylesheets>' }
  58. },
  59. icons: {
  60. options: { compress: true },
  61. files: { 'packages/lungo/**.css': '<config:resources.icons>' }
  62. },
  63. flatten: {
  64. options: { flatten: true },
  65. files: { 'packages/lungo/**.css': '<config:resources.themes>' }
  66. }
  67. },
  68. copy: {
  69. example: {
  70. files: { 'example/components/lungo/': ['packages/lungo/*'] }
  71. },
  72. target: {
  73. files: { 'packages/lungo.theme/': ['<config:resources.themes>'] }
  74. }
  75. },
  76. watch: {
  77. files: ['<config:resources.coffeescripts>', '<config:resources.stylesheets>', '<config:resources.themes>'],
  78. tasks: 'coffee concat min stylus copy'
  79. }
  80. });
  81. grunt.loadNpmTasks('grunt-coffee');
  82. grunt.loadNpmTasks('grunt-contrib-stylus');
  83. grunt.loadNpmTasks('grunt-contrib-copy');
  84. // Default task.
  85. grunt.registerTask('default', 'coffee concat min stylus copy');
  86. };