Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-jst-prepend

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-jst-prepend

Prepend some variables to the generated template files by grunt-contrib-jst module.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

grunt-jst-prepend v0.0.1 Build Status: Linux

Prepend some variables to the generated template files by grunt-contrib-jst module.

Getting Started

This plugin requires Grunt ~0.4.0

npm install grunt-jst-prepend --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-jst-prepend');

Options

prepend

Type: function or string

The variables declared before compiling templates, which will be prepend to the generated template files. It is usefull when one just need the _.template() method but don't want to use the whole underscore or lodash lib. If the option prettify is true then all whitespaces in the prepend string will be removed.

prepend: function() {
  var vars = function() {
    var _ = {};

    _.escape = function() {
      var escapeMap = {
        '&': '&',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        "'": '&#x27;'
      };
      var escapeRegexe = new RegExp('[' + Object.keys(escapeMap).join('') + ']', 'g');

      if (string == null) return '';
      return ('' + string).replace(escapeRegexe, function(match) {
        return escapeMap[match];
      });
    };
  };

  var entire = vars.toString();

  return entire.slice(entire.indexOf('{') + 1, entire.lastIndexOf('}'));
}

Please go to grunt-contrib-jst to read more.

Keywords

FAQs

Package last updated on 31 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc