2
0

Gruntfile.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. 'use strict';
  2. module.exports = function (grunt) {
  3. var path = require('path');
  4. // These plugins provide necessary tasks.
  5. grunt.loadNpmTasks('grunt-contrib-clean');
  6. grunt.loadNpmTasks('grunt-contrib-requirejs');
  7. grunt.loadNpmTasks('grunt-execute');
  8. grunt.loadNpmTasks('amber-dev');
  9. // Default task.
  10. grunt.registerTask('default', ['amberc:all']);
  11. grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
  12. grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
  13. // Project configuration.
  14. grunt.initConfig({
  15. // Metadata.
  16. // pkg: grunt.file.readJSON(''),
  17. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  18. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  19. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  20. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  21. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  22. // task configuration
  23. amberc: {
  24. options: {
  25. amber_dir: path.join(__dirname, "bower_components", "amber"),
  26. library_dirs: ['src'],
  27. closure_jar: ''
  28. },
  29. all: {
  30. src: [
  31. 'src/Processing-Examples.st' // list all sources in dependency order
  32. ],
  33. amd_namespace: 'amber-processingclock',
  34. libraries: ['SUnit', 'Web']
  35. }
  36. },
  37. amdconfig: {app: {dest: 'config.js'}},
  38. requirejs: {
  39. deploy: {options: {
  40. mainConfigFile: "config.js",
  41. onBuildWrite: function (moduleName, path, contents) {
  42. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
  43. },
  44. pragmas: {
  45. excludeIdeData: true,
  46. excludeDebugContexts: true
  47. },
  48. include: ['config', 'node_modules/requirejs/require', 'deploy'],
  49. out: "the.js"
  50. }},
  51. devel: {options: {
  52. mainConfigFile: "config.js",
  53. onBuildWrite: function (moduleName, path, contents) {
  54. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
  55. },
  56. include: ['config', 'node_modules/requirejs/require'],
  57. out: "the.js"
  58. }}
  59. }
  60. });
  61. };