Gruntfile.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. module.exports = function(grunt) {
  2. require('load-grunt-tasks')(grunt);
  3. grunt.loadNpmTasks('grunt-execute');
  4. grunt.loadNpmTasks('grunt-contrib-clean');
  5. grunt.initConfig({
  6. clean: ["dist"],
  7. copy: {
  8. src_to_dist: {
  9. cwd: 'src',
  10. expand: true,
  11. src: ['**/*', '!**/*.js', '!**/*.scss'],
  12. dest: 'dist'
  13. },
  14. pluginDef: {
  15. expand: true,
  16. src: ['plugin.json', 'readme.md'],
  17. dest: 'dist',
  18. }
  19. },
  20. watch: {
  21. rebuild_all: {
  22. files: ['src/**/*', 'plugin.json', 'readme.md'],
  23. tasks: ['default'],
  24. options: {spawn: false}
  25. },
  26. },
  27. babel: {
  28. options: {
  29. sourceMap: true,
  30. presets: ["es2015"],
  31. plugins: ['transform-es2015-modules-systemjs', "transform-es2015-for-of"],
  32. },
  33. dist: {
  34. files: [{
  35. cwd: 'src',
  36. expand: true,
  37. src: ['**/*.js'],
  38. dest: 'dist',
  39. ext:'.js'
  40. }]
  41. },
  42. },
  43. });
  44. grunt.registerTask('default', ['clean', 'copy:src_to_dist', 'copy:pluginDef', 'babel']);
  45. };