grunt.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. javascripts: ['src/**/*.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. 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. },
  52. min: {
  53. js: {
  54. src: ['<banner>', 'build/<%=meta.file%>.js'],
  55. dest: 'packages/<%=meta.file%>/<%=meta.file%>.js'
  56. }
  57. },
  58. copy: {
  59. example: {
  60. files: { 'example/components/lungo/': ['packages/lungo/*'] }
  61. },
  62. target: {
  63. files: { 'packages/lungo.theme/': ['<config:resources.themes>'] }
  64. }
  65. },
  66. watch: {
  67. files: ['<config:resources.javascripts>', '<config:resources.stylesheets>', '<config:resources.themes>'],
  68. tasks: 'concat min stylus copy'
  69. }
  70. });
  71. grunt.loadNpmTasks('grunt-contrib-stylus');
  72. grunt.loadNpmTasks('grunt-contrib-copy');
  73. // Default task.
  74. grunt.registerTask('default', 'concat min stylus copy');
  75. };