jst.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * `tasks/config/jst`
  3. *
  4. * ---------------------------------------------------------------
  5. *
  6. * Precompile HTML templates using Underscore/Lodash notation.
  7. *
  8. * For more information, see:
  9. * https://sailsjs.com/anatomy/tasks/config/jst.js
  10. *
  11. */
  12. module.exports = function(grunt) {
  13. grunt.config.set('jst', {
  14. dev: {
  15. // To use other sorts of templates, specify a regexp like the example below:
  16. // options: {
  17. // templateSettings: {
  18. // interpolate: /\{\{(.+?)\}\}/g
  19. // }
  20. // },
  21. // Note that the interpolate setting above is simply an example of overwriting lodash's
  22. // default interpolation. If you want to parse templates with the default _.template behavior
  23. // (i.e. using <div><%= this.id %></div>), there's no need to overwrite `templateSettings.interpolate`.
  24. files: {
  25. // e.g.
  26. // 'relative/path/from/gruntfile/to/compiled/template/destination' : ['relative/path/to/sourcefiles/**/*.html']
  27. '.tmp/public/jst.js': require('../pipeline').templateFilesToInject
  28. }
  29. }
  30. });
  31. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  32. // This Grunt plugin is part of the default asset pipeline in Sails,
  33. // so it's already been automatically loaded for you at this point.
  34. //
  35. // Of course, you can always remove this Grunt plugin altogether by
  36. // deleting this file. But check this out: you can also use your
  37. // _own_ custom version of this Grunt plugin.
  38. //
  39. // Here's how:
  40. //
  41. // 1. Install it as a local dependency of your Sails app:
  42. // ```
  43. // $ npm install grunt-contrib-jst --save-dev --save-exact
  44. // ```
  45. //
  46. //
  47. // 2. Then uncomment the following code:
  48. //
  49. // ```
  50. // // Load Grunt plugin from the node_modules/ folder.
  51. // grunt.loadNpmTasks('grunt-contrib-jst');
  52. // ```
  53. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  54. };