2.0.2 • Published 4 years ago

gridfw-compiler v2.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

gridfw-compiler

Compile sources files for gridfw

Compile js templates

// use default options
gulp.src(...)
    .pipe( GfwCompiler.template({params}) )

Compile views

By default, The the framework supports "pug" files

// use default options
compiler.views()

To support an other engine, add the code that will compile each file mapped by the file extension. Example:

// use default options
compiler.views({
    engines: {
        // fileExtension: function(content, options){}
        pug: function(content, options){
            // compile content
            content = Pug.compileClient(content, {
                pretty: options.pretty,
                filename: options.filename,
                name: 'template' // result function name
            });
            // export data
            return content + "\nmodule.exports = template";
        },
        ejs: function(content, options){
            // compile content
            content = EJS.compile({
                pretty: options.pretty,
                filename: options.filename,
                client: true, // render client function
            });
            // export data
            return "module.exports = " + content.toString();
        }
    }
})

Supporters

coredigix

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago