babel.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * `tasks/config/babel`
  3. *
  4. * ---------------------------------------------------------------
  5. *
  6. * Transpile >=ES6 code for broader browser compatibility.
  7. *
  8. * For more information, see:
  9. * https://sailsjs.com/anatomy/tasks/config/babel.js
  10. *
  11. */
  12. module.exports = function(grunt) {
  13. grunt.config.set('babel', {
  14. dist: {
  15. options: {
  16. presets: [require('sails-hook-grunt/accessible/babel-preset-env')]
  17. },
  18. files: [
  19. {
  20. expand: true,
  21. cwd: '.tmp/public',
  22. src: ['js/**/*.js'],
  23. dest: '.tmp/public'
  24. }
  25. ]
  26. }
  27. });
  28. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  29. // This Grunt plugin is part of the default asset pipeline in Sails,
  30. // so it's already been automatically loaded for you at this point.
  31. //
  32. // Of course, you can always remove this Grunt plugin altogether by
  33. // deleting this file. But check this out: you can also use your
  34. // _own_ custom version of this Grunt plugin.
  35. //
  36. // Here's how:
  37. //
  38. // 1. Install it as a local dependency of your Sails app:
  39. // ```
  40. // $ npm install grunt-babel --save-dev --save-exact
  41. // ```
  42. //
  43. //
  44. // 2. Then uncomment the following code:
  45. //
  46. // ```
  47. // // Load Grunt plugin from the node_modules/ folder.
  48. // grunt.loadNpmTasks('grunt-babel');
  49. // ```
  50. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  51. };