2
0

Gruntfile.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. amberc: {
  22. options: {
  23. amber_dir: path.join(__dirname, "bower_components", "amber"),
  24. library_dirs: ['src'],
  25. closure_jar: ''
  26. },
  27. all: {
  28. src: [
  29. 'src/Presentation.st', // list all sources in dependency order
  30. ],
  31. amd_namespace: 'amber-presentation',
  32. libraries: ['Web']
  33. },
  34. },
  35. amdconfig: {app: {dest: 'config.js'}},
  36. requirejs: {
  37. deploy: {options: {
  38. mainConfigFile: "config.js",
  39. onBuildWrite: function (moduleName, path, contents) {
  40. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
  41. },
  42. pragmas: {
  43. excludeIdeData: true,
  44. excludeDebugContexts: true
  45. },
  46. include: ['config', 'node_modules/requirejs/require', 'deploy'],
  47. out: "the.js"
  48. }},
  49. devel: {options: {
  50. mainConfigFile: "config.js",
  51. onBuildWrite: function (moduleName, path, contents) {
  52. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
  53. },
  54. include: ['config', 'node_modules/requirejs/require'],
  55. out: "the.js"
  56. }}
  57. }
  58. });
  59. };