1
0

Gruntfile.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. module.exports = function (grunt) {
  3. var path = require('path');
  4. // These plugins provide necessary tasks.
  5. grunt.loadNpmTasks('grunt-contrib-requirejs');
  6. grunt.loadNpmTasks('amber-dev');
  7. // Default task.
  8. grunt.registerTask('default', ['amberc:all']);
  9. grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
  10. grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
  11. // Project configuration.
  12. grunt.initConfig({
  13. // Metadata.
  14. // pkg: grunt.file.readJSON(''),
  15. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  16. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  17. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  18. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  19. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  20. // task configuration
  21. amdconfig: {app: {dest: 'config.js'}},
  22. requirejs: {
  23. deploy: {options: {
  24. mainConfigFile: "config.js",
  25. onBuildWrite: function (moduleName, path, contents) {
  26. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
  27. },
  28. pragmas: {
  29. excludeIdeData: true,
  30. excludeDebugContexts: true
  31. },
  32. optimize: 'uglify2',
  33. include: ['config', 'node_modules/requirejs/require', 'deploy'],
  34. out: "the.js"
  35. }},
  36. devel: {options: {
  37. mainConfigFile: "config.js",
  38. onBuildWrite: function (moduleName, path, contents) {
  39. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
  40. },
  41. include: ['config', 'node_modules/requirejs/require'],
  42. out: "the.js"
  43. }}
  44. }
  45. });
  46. };