function

generate . files . sncode

VERSIONlatest Used to generate a file.

GENERATE

NAME

generate - Used to generate a file.

SYNOPSIS

generate (template : template.sn, file : filename, jsmin : true | false, cssmin : true | false, error : true | FALSE, compile : true, delcompile : false)

DESCRIPTION

This function is used to generate a file from a template.

PARAMETERS

Here is the list of parameters:

template
Template to use. The default value is template.sn.
filename
File to generate. No default value. If no filename is specified, return the result of the generate in the result. You cannot have ompile without filename.
jsmin
If jsmin is set to true, then the file is passed threw jsmin compression. If an error occured in the JS (unterminated string), the file is not compress.
cssmin
If cssmin is set to true, then the file is passed threw cssmin compression.
compile
If compile is set to true, the file will be generated in a temporary file in /tmp and this file will be parsed to generate the real file.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

generate(file:"gen.sn",template:"template4.sn");
generate(delcompile: false, compile: true, file:"gen.snc",template:"template5.sn");

template5.sn {_{
        global a;
        'a=';a;
        a=12;
        "{_{ a="; a; "; ',a from = '; a; }}";
}} \{_{
        for(i=0;i<5;++i) do
                i;
        endfor
}}

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>