grunt.js 2.8 KB

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