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

grunt-fest

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-fest

Compile Fest templates

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-fest Build Status

Compile Fest templates.

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-fest --save-dev

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

grunt.loadNpmTasks('grunt-fest');

The "fest" task

Overview

In your project's Gruntfile, add a section named fest to the data object passed into grunt.initConfig().

grunt.initConfig({
    fest: {
        options: {
            // Task-specific options go here.
        },
        target: {
            options: {
                // Target-specific options go here.
            }
        }
    }
})

Options

options.require

Type: String Default value: fest

Path to require Fest library.

options.compile

Type: Object Default value: undefined

Fest’s compile() options.

options.ext

Type: String Default value: .js

Compiled file’s extension.

options.template

Type: Function Default value: undefined

This function is called when template will be compiled. It takes an argument as an object with the following properties:

  • src — path to the template
  • relSrc — relative path to the template
  • dest — path to the compiled file
  • name — template’s name (relative to the source directory and w/o the extension)
  • basename — template’s basename
  • contents — compiled template

Usage Examples

Static mappings
grunt.initConfig({
    fest: {
        options: {
            compile: {
                beautify: true,
                debug: true
            }
        },
        put_in_the_same_derictory: { // Compiles "fest/**/*.xml" to "fest/**/*.js"
            src: 'fest/**/*.xml'
        },
        put_in_the_same_derictory_and_append_ext: { // Compiles "fest/**/*.xml" to "fest/**/*.xml.js"
            src: 'fest/**/*.xml',
            options: {
                ext: '.xml.js'
            }
        },
        'build': ['fest/**/*.xml'] // Compiles "test/**/*.xml" to "build/fest/**/*.js"
    }
})
Dynamic mappings

In this example Fest compiles "fest//*.xml" to "fest-build//*.js". See Building the files object dynamically documentation for more information.

grunt.initConfig({
    fest: {
        build: {
            files: [{
                expand: true,       // Enable dynamic expantion.
                cwd: 'fest',        // Src matches are relative to this path.
                src: ['**/*.xml'],  // Actual pattern(s) to match.
                dest: 'fest-build', // Destination path prefix.
                ext: '.js'          // Dest filepaths will have this extension.
            }],
            options: {
                compile: {
                    debug: false,
                    beautify: false
                }
            }
        }
    }
})
Template’s Usage

In this example Grunt builds AMD modules for the compiled templates.

grunt.initConfig({
    fest: {
        build: {
            files: [{
                expand: true,       // Enable dynamic expantion.
                cwd: 'fest',        // Src matches are relative to this path.
                src: ['**/*.xml'],  // Actual pattern(s) to match.
                dest: 'fest-build', // Destination path prefix.
                ext: '.js'          // Dest filepaths will have this extension.
            }],
            options: {
                template: function (data) {
                    // Make AMD module
                    return grunt.template.process(
                        'define(<%= JSON.stringify(name + ".js")  %>, function () { return <%= contents %> ; });',
                        {data: data}
                    );
                },
                compile: {
                    debug: false,
                    beautify: false
                }
            }
        }
    }
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2013-02-22 v0.1.0 First official release.

Keywords

FAQs

Package last updated on 22 Feb 2013

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