123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- /**
- * `tasks/config/sails-linker`
- *
- * ---------------------------------------------------------------
- *
- * Automatically inject <script> tags and <link> tags into the specified
- * specified HTML and/or EJS files. The specified delimiters (`startTag`
- * and `endTag`) determine the insertion points.
- *
- * For more information, see:
- * https://sailsjs.com/anatomy/tasks/config/sails-linker.js
- *
- */
- module.exports = function(grunt) {
- grunt.config.set('sails-linker', {
- // ╦╔═╗╦ ╦╔═╗╔═╗╔═╗╦═╗╦╔═╗╔╦╗
- // ║╠═╣╚╗╔╝╠═╣╚═╗║ ╠╦╝║╠═╝ ║
- // ╚╝╩ ╩ ╚╝ ╩ ╩╚═╝╚═╝╩╚═╩╩ ╩
- // ┌─ ┌─┐┬ ┬┌─┐┌┐┌┌┬┐ ┌─┐┬┌┬┐┌─┐ ┬┌─┐┬ ┬┌─┐┌─┐┌─┐┬─┐┬┌─┐┌┬┐ ─┐
- // │─── │ │ │├┤ │││ │───└─┐│ ││├┤ │├─┤└┐┌┘├─┤└─┐│ ├┬┘│├─┘ │ ───│
- // └─ └─┘┴─┘┴└─┘┘└┘ ┴ └─┘┴─┴┘└─┘ └┘┴ ┴ └┘ ┴ ┴└─┘└─┘┴└─┴┴ ┴ ─┘
- devJs: {
- options: {
- startTag: '<!--SCRIPTS-->',
- endTag: '<!--SCRIPTS END-->',
- fileTmpl: '<script src="%s"></script>',
- appRoot: '.tmp/public'
- },
- files: {
- '.tmp/public/**/*.html': require('../pipeline').jsFilesToInject,
- 'views/**/*.html': require('../pipeline').jsFilesToInject,
- 'views/**/*.ejs': require('../pipeline').jsFilesToInject
- }
- },
- devJsBuild: {
- options: {
- startTag: '<!--SCRIPTS-->',
- endTag: '<!--SCRIPTS END-->',
- fileTmpl: '<script src="%s"></script>',
- appRoot: '.tmp/public',
- // relative: true
- // ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
- // (but be note that this can break custom font URLs)
- },
- files: {
- '.tmp/public/**/*.html': require('../pipeline').jsFilesToInject,
- 'views/**/*.html': require('../pipeline').jsFilesToInject,
- 'views/**/*.ejs': require('../pipeline').jsFilesToInject
- }
- },
- prodJs: {
- options: {
- startTag: '<!--SCRIPTS-->',
- endTag: '<!--SCRIPTS END-->',
- fileTmpl: '<script src="%s"></script>',
- appRoot: '.tmp/public'
- },
- files: {
- '.tmp/public/**/*.html': ['.tmp/public/min/production.min.js'],
- 'views/**/*.html': ['.tmp/public/min/production.min.js'],
- 'views/**/*.ejs': ['.tmp/public/min/production.min.js']
- }
- },
- prodJsBuild: {
- options: {
- startTag: '<!--SCRIPTS-->',
- endTag: '<!--SCRIPTS END-->',
- fileTmpl: '<script src="%s"></script>',
- appRoot: '.tmp/public',
- // relative: true
- // ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
- // (but be note that this can break custom font URLs)
- },
- files: {
- '.tmp/public/**/*.html': ['.tmp/public/min/production.min.js'],
- 'views/**/*.html': ['.tmp/public/min/production.min.js'],
- 'views/**/*.ejs': ['.tmp/public/min/production.min.js']
- }
- },
- // ╔═╗╔╦╗╦ ╦╦ ╔═╗╔═╗╦ ╦╔═╗╔═╗╔╦╗╔═╗
- // ╚═╗ ║ ╚╦╝║ ║╣ ╚═╗╠═╣║╣ ║╣ ║ ╚═╗
- // ╚═╝ ╩ ╩ ╩═╝╚═╝╚═╝╩ ╩╚═╝╚═╝ ╩ ╚═╝
- // ┌─ ┬┌┐┌┌─┐┬ ┬ ┬┌┬┐┬┌┐┌┌─┐ ╔═╗╔═╗╔═╗ ┬ ┌─┐┌─┐┌┬┐┌─┐┬┬ ┌─┐┌┬┐ ╦ ╔═╗╔═╗╔═╗ ─┐
- // │─── │││││ │ │ │ │││││││ ┬ ║ ╚═╗╚═╗ ┌┼─ │ │ ││││├─┘││ ├┤ ││ ║ ║╣ ╚═╗╚═╗ ───│
- // └─ ┴┘└┘└─┘┴─┘└─┘─┴┘┴┘└┘└─┘ ╚═╝╚═╝╚═╝ └┘ └─┘└─┘┴ ┴┴ ┴┴─┘└─┘─┴┘ ╩═╝╚═╝╚═╝╚═╝ ─┘
- devStyles: {
- options: {
- startTag: '<!--STYLES-->',
- endTag: '<!--STYLES END-->',
- fileTmpl: '<link rel="stylesheet" href="%s">',
- appRoot: '.tmp/public'
- },
- files: {
- '.tmp/public/**/*.html': require('../pipeline').cssFilesToInject,
- 'views/**/*.html': require('../pipeline').cssFilesToInject,
- 'views/**/*.ejs': require('../pipeline').cssFilesToInject
- }
- },
- devStylesBuild: {
- options: {
- startTag: '<!--STYLES-->',
- endTag: '<!--STYLES END-->',
- fileTmpl: '<link rel="stylesheet" href="%s">',
- appRoot: '.tmp/public',
- // relative: true
- // ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
- // (but be note that this can break custom font URLs)
- },
- files: {
- '.tmp/public/**/*.html': require('../pipeline').cssFilesToInject,
- 'views/**/*.html': require('../pipeline').cssFilesToInject,
- 'views/**/*.ejs': require('../pipeline').cssFilesToInject
- }
- },
- prodStyles: {
- options: {
- startTag: '<!--STYLES-->',
- endTag: '<!--STYLES END-->',
- fileTmpl: '<link rel="stylesheet" href="%s">',
- appRoot: '.tmp/public'
- },
- files: {
- '.tmp/public/index.html': ['.tmp/public/min/production.min.css'],
- 'views/**/*.html': ['.tmp/public/min/production.min.css'],
- 'views/**/*.ejs': ['.tmp/public/min/production.min.css']
- }
- },
- prodStylesBuild: {
- options: {
- startTag: '<!--STYLES-->',
- endTag: '<!--STYLES END-->',
- fileTmpl: '<link rel="stylesheet" href="%s">',
- appRoot: '.tmp/public',
- // relative: true
- // ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
- // (but be note that this can break custom font URLs)
- },
- files: {
- '.tmp/public/index.html': ['.tmp/public/min/production.min.css'],
- 'views/**/*.html': ['.tmp/public/min/production.min.css'],
- 'views/**/*.ejs': ['.tmp/public/min/production.min.css']
- }
- },
- // ╔═╗╦═╗╔═╗╔═╗╔═╗╔╦╗╔═╗╦╦ ╔═╗╔╦╗ ╦ ╦╔╦╗╔╦╗╦ ╔╦╗╔═╗╔╦╗╔═╗╦ ╔═╗╔╦╗╔═╗╔═╗
- // ╠═╝╠╦╝║╣ ║ ║ ║║║║╠═╝║║ ║╣ ║║ ╠═╣ ║ ║║║║ ║ ║╣ ║║║╠═╝║ ╠═╣ ║ ║╣ ╚═╗
- // ╩ ╩╚═╚═╝╚═╝╚═╝╩ ╩╩ ╩╩═╝╚═╝═╩╝ ╩ ╩ ╩ ╩ ╩╩═╝ ╩ ╚═╝╩ ╩╩ ╩═╝╩ ╩ ╩ ╚═╝╚═╝
- // ┌─ ┌─┐┬ ┬┌─┐┌┐┌┌┬┐ ┌─┐┬┌┬┐┌─┐ ┬ ┌─┐┌┬┐┌─┐┌─┐┬ ┬ ┌┬┐┌─┐┌┬┐┌─┐┬ ┌─┐┌┬┐┌─┐┌─┐ ─┐
- // │─── │ │ │├┤ │││ │───└─┐│ ││├┤ │ │ │ ││├─┤└─┐├─┤ │ ├┤ │││├─┘│ ├─┤ │ ├┤ └─┐ ───│
- // └─ └─┘┴─┘┴└─┘┘└┘ ┴ └─┘┴─┴┘└─┘ ┴─┘└─┘─┴┘┴ ┴└─┘┴ ┴ ┴ └─┘┴ ┴┴ ┴─┘┴ ┴ ┴ └─┘└─┘ ─┘
- clientSideTemplates: {
- options: {
- startTag: '<!--TEMPLATES-->',
- endTag: '<!--TEMPLATES END-->',
- fileTmpl: '<script type="text/javascript" src="%s"></script>',
- appRoot: '.tmp/public'
- },
- files: {
- '.tmp/public/index.html': ['.tmp/public/jst.js'],
- 'views/**/*.html': ['.tmp/public/jst.js'],
- 'views/**/*.ejs': ['.tmp/public/jst.js']
- }
- },
- clientSideTemplatesBuild: {
- options: {
- startTag: '<!--TEMPLATES-->',
- endTag: '<!--TEMPLATES END-->',
- fileTmpl: '<script type="text/javascript" src="%s"></script>',
- appRoot: '.tmp/public',
- // relative: true
- // ^^ Uncomment this if compiling assets for use in PhoneGap, CDN, etc.
- // (but be note that this can break custom font URLs)
- },
- files: {
- '.tmp/public/index.html': ['.tmp/public/jst.js'],
- 'views/**/*.html': ['.tmp/public/jst.js'],
- 'views/**/*.ejs': ['.tmp/public/jst.js']
- }
- },
- });//</ grunt.config.set() >
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // This Grunt plugin is part of the default asset pipeline in Sails,
- // so it's already been automatically loaded for you at this point.
- //
- // Of course, you can always remove this Grunt plugin altogether by
- // deleting this file. But check this out: you can also use your
- // _own_ custom version of this Grunt plugin.
- //
- // Here's how:
- //
- // 1. Install it as a local dependency of your Sails app:
- // ```
- // $ npm install grunt-sails-linker --save-dev --save-exact
- // ```
- //
- //
- // 2. Then uncomment the following code:
- //
- // ```
- // // Load Grunt plugin from the node_modules/ folder.
- // grunt.loadNpmTasks('grunt-sails-linker');
- // ```
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- };
|