grunt.js 2.5 KB

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