1.0.1 • Published 3 years ago

@bitfertig/blade-compiler.nodejs v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Blade Compiler

This package compiles blade templates to HTML.

Installation

Via NPM:

$ npm install @bitfertig/blade-compiler.nodejs

Usage

Require the package and compile a blade file:

var prop = { title: 'MyTitle' }; // Data
var bladeCompiler = require('@bitfertig/blade-compiler.nodejs');
var compiledHTML = bladeCompiler({ folder: './src', file: '/index' });
console.log(compiledHTML);

./src/index.blade.html

<html>
    <head>{{ prop.title }}</head>
    <body>
        @include('partials.header')
    </body>
</html>

./src/partials/header.blade.html

<header>Hello World.</header>

Options

NameTypeDefault valueDescription
encodingstringutf8Blade templates encoding
extendsbooleantrueEnable/disable compiling @extends directives
folderstring./srcPath to the views directory
filestring/indexPath to the compiled blade template file
extensionstring.blade.htmlBlade file extension

Author

Aurelian Hermand, www.bitfertig.de

Cloned from https://github.com/pbelyaev/laravel-blade-compiler