grunt.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. module.exports = function(grunt) {
  2. // Project configuration.
  3. grunt.initConfig({
  4. pkg: '<json:packages/lungo/component.json>',
  5. meta: {
  6. file: "lungo",
  7. // BETA
  8. endpoint: "example/components",
  9. version: ".brownie",
  10. // RELEASE
  11. // endpoint: "packages",
  12. // version: "",
  13. banner: '/* <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("yyyy/m/d") %>\n' +
  14. ' <%= pkg.homepage %>\n' +
  15. ' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>' +
  16. ' - Licensed <%= _.pluck(pkg.license, "type").join(", ") %> */'
  17. },
  18. resources: {
  19. coffeescripts: ['src/**/*.coffee'],
  20. core: ['build/src/Lungo.js'],
  21. modules: [
  22. 'build/src/modules/*.js',
  23. 'build/src/boot/*.js',
  24. 'build/src/data/*.js',
  25. 'build/src/element/*.js',
  26. 'build/src/router/Lungo.Router.js', 'build/src/router/Lungo.Router.*.js'],
  27. stylesheets: [
  28. 'src/**/lungo.base.styl',
  29. 'src/**/lungo.layout.styl',
  30. 'src/**/lungo.layout.*.styl',
  31. 'src/**/lungo.widgets.styl',
  32. 'src/**/lungo.widgets.*.styl',
  33. 'src/**/lungo.media.*.styl'],
  34. icons: ['src/**/lungo.icon**.styl'],
  35. themes: ['src/**/theme**.styl']
  36. },
  37. coffee: {
  38. lungo: {
  39. src: ['<config:resources.coffeescripts>'],
  40. dest: 'build',
  41. options: {
  42. bare: true,
  43. preserve_dirs: true
  44. }
  45. }
  46. },
  47. concat: {
  48. js: {
  49. src: ['<banner>', '<config:resources.core>', '<config:resources.modules>'],
  50. dest: 'build/<%=meta.file%>.js'
  51. }
  52. },
  53. min: {
  54. js: {
  55. src: ['<banner>', 'build/<%=meta.file%>.js'],
  56. dest: '<%=meta.endpoint%>/<%=meta.file%><%=meta.version%>/<%=meta.file%>.js'
  57. }
  58. },
  59. stylus: {
  60. stylesheets: {
  61. options: { compress: true, paths: ['src/stylesheets/import'] },
  62. files: { '<%=meta.endpoint%>/<%=meta.file%><%=meta.version%>/<%=meta.file%>.css': '<config:resources.stylesheets>' }
  63. },
  64. icons: {
  65. options: { compress: true },
  66. files: { '<%=meta.endpoint%>/<%=meta.file%><%=meta.version%>/**.css': '<config:resources.icons>' }
  67. },
  68. flatten: {
  69. options: { flatten: true },
  70. files: { '<%=meta.endpoint%>/<%=meta.file%><%=meta.version%>/**.css': '<config:resources.themes>' }
  71. }
  72. },
  73. copy: {
  74. example: {
  75. files: { 'example/components/<%=meta.file%>/': ['<%=meta.endpoint%>/<%=meta.file%>/*'] }
  76. },
  77. target: {
  78. files: { '<%=meta.endpoint%>/<%=meta.file%>.theme/': ['<config:resources.themes>'] }
  79. }
  80. },
  81. watch: {
  82. files: ['<config:resources.coffeescripts>', '<config:resources.stylesheets>', '<config:resources.themes>'],
  83. tasks: 'coffee concat min stylus'
  84. }
  85. });
  86. grunt.loadNpmTasks('grunt-coffee');
  87. grunt.loadNpmTasks('grunt-contrib-stylus');
  88. grunt.loadNpmTasks('grunt-contrib-copy');
  89. // Default task.
  90. grunt.registerTask('default', 'coffee concat min stylus copy');
  91. };