New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

grunt-script-template

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-script-template

Generates files using script-template

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

grunt-script-template

Grunt task to generate files using script-template.

Overview

To use grunt-script-template you'll need three things: a template, data, and a destination. grunt-script-template will then run the data against the template and store the result in the specified destination. Both the template and destination are specified as relative paths to the files. Data may be specified as JSON data within the Gruntfile.js or can be specified as a function which will be evaluated with the result run against the template.

Specification

Inside your grunt.initConfig call you'll want to specify each template you want to run and a corresponding template (src), destination (dest), and data (data).

For example, the following is the configuration for the tests included with grunt-script-template:

grunt.initConfig({

    pkg: 'package.json',

    'script-template': {
        'static-array-test': {
            src: 'test/static-array-template.ts',
            dest: 'temp/static-array.ts',
            data: ['One', 'Two', 'Three']
        },
        'static-object-test': {
            src: 'test/static-object-template.ts',
            dest: 'temp/static-object.ts',
            data: {title: 'Static Object Title', values: ['a', 'b', 'c']}
        },
        'dynamic-one-test': {
            src: 'test/dynamic-one-template.ts',
            dest: 'temp/dynamic-one.ts',
            data: getData                        
                    // getData is a previously defined function,
                    // notice no parenthesis, passing the function, 
                    // not the results
        }
    },

    clean: {
        tests: ['temp']
    },

    'jasmine_node': {
        'tests': ['test/']
    }
});

grunt.loadNpmTasks('grunt-script-template');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jasmine-node');

grunt.registerTask('default', ['clean', 'script-template', 'jasmine_node']);

script-template

script-template is a simple templating engine designed to generate scripts (JavaScript, TypeScript, CoffeeScript). The main advantage of this engine is that the source templates are themselves valid JavaScript/TypeScript/CoffeeScript.

For more information on templates and data, see https://github.com/samuelneff/script-template.

License

Copyright (c) 2014 Samuel Neff Licensed under the (MIT license)[https://github.com/samuelneff/grunt-script-template/blob/master/LICENSE-MIT].

Keywords

gruntplugin

FAQs

Package last updated on 06 Mar 2016

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