https://github.com/bitfertig/blade-compiler.nodejs
https://github.com/bitfertig/blade-compiler.nodejs
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/bitfertig/blade-compiler.nodejs
- Owner: Bitfertig
- License: mit
- Created: 2020-11-19T22:31:40.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-20T00:12:35.000Z (over 5 years ago)
- Last Synced: 2025-03-17T20:41:32.774Z (over 1 year ago)
- Language: JavaScript
- Size: 69.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```