grunt.js 2.5 KB

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