An open API service indexing awesome lists of open source software.

https://github.com/bitfertig/blade-compiler.nodejs


https://github.com/bitfertig/blade-compiler.nodejs

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# Blade Compiler

This package compiles blade templates to HTML.

## Installation

Via NPM:
```console
$ npm install @bitfertig/blade-compiler.nodejs
```

## Usage

Require the package and compile a blade file:
```js
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

{{ prop.title }}

@include('partials.header')

```

./src/partials/header.blade.html
```html
Hello World.
```

## Options

| Name | Type | Default value | Description |
|---|---|---|---|
| encoding | string | utf8 | Blade templates encoding |
| extends | boolean | true | Enable/disable compiling @extends directives |
| folder | string | ./src | Path to the views directory |
| file | string | /index | Path to the compiled blade template file |
| extension | string | .blade.html | Blade file extension |

## Author
Aurelian Hermand, www.bitfertig.de

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

### Some commands

```bash
# Publishing initial npm package
npm publish --access public
# Publishing npm versions after changing version in package.json
npm publish
```