Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/machy8/macdom
🍩 The best, highly customizable HTML preprocessor with many amazing features https://machy8.github.io/Macdom/.
https://github.com/machy8/macdom
html-preprocessor minification preprocessor simplification templating
Last synced: about 2 months ago
JSON representation
🍩 The best, highly customizable HTML preprocessor with many amazing features https://machy8.github.io/Macdom/.
- Host: GitHub
- URL: https://github.com/machy8/macdom
- Owner: Machy8
- License: bsd-3-clause
- Created: 2015-11-06T16:58:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-23T20:34:34.000Z (over 5 years ago)
- Last Synced: 2024-11-10T20:35:58.326Z (about 2 months ago)
- Topics: html-preprocessor, minification, preprocessor, simplification, templating
- Language: PHP
- Homepage:
- Size: 1.95 MB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
README
# Macdom
[![Build Status](https://travis-ci.org/Machy8/Macdom.svg?branch=3.0)](https://travis-ci.org/Machy8/Macdom)
[![Coverage Status](https://coveralls.io/repos/github/Machy8/Macdom/badge.svg?branch=master)](https://coveralls.io/github/Machy8/Macdom?branch=master)
[![Packagist](https://img.shields.io/packagist/v/machy8/macdom.svg?maxAge=2592000)](https://packagist.org/packages/machy8/macdom)
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/Machy8/Macdom/blob/master/license.md)
[![Join the chat at https://gitter.im/Machy8/Macdom](https://badges.gitter.im/Machy8/Macdom.svg)](https://gitter.im/Machy8/Macdom?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)- For more information see [WIKI](https://github.com/Machy8/Macdom/wiki) *(always up to date to the newest stable version)*
- **[Try it on CODEPEN](http://codepen.io/Machy8/pen/mPLdbg)** *(JavaScript version is always behind the php version so it may contain bugs and errors that have already been fixed in the PHP version)*## Sample
**Macdom**
```` Slim
!5
html
head
utf-8
viewport
favicon includes/favicon.ico
title Macdom example
body
h1 #title .titles .main-title Hello world
nav
@ a $http://www.[@].com $blank Link on -
[google] .first-link Google
[yahoo] Yahoo
[github] Github
div #wrapper Some text here.
https://www.code.jquery.com/jquery-1.12.0.min.js async````
**Result**
```` html
Macdom example
Hello world
Link on - Google
Link on - Yahoo
Link on - Github
Some text here.
````
## Requirements
- PHP 7.0+
- If you use Nette Framework - v2.3+## Installation
**1 - Download the Macdom using composer:**
```
composer require machy8/macdom
```
**2 - Usage:***Typical:*
```php
$macdom = new Macdom\Engine;
$compiled = $macdom->compile($content);
```*Nette framework:*
```PHPuse Macdom\Bridges\Latte\FileLoader;
use Macdom\Engine;/**
* @var Engine
*/
private $macdom;/**
* @var FileLoader
*/
private $fileLoader;public function __construct(Engine $macdom, FileLoader $fileLoader) {
$this->macdom = $macdom;
$this->fileLoader = $fileLoader;
}protected function createTemplate()
{
$template = parent::createTemplate();
$this->fileLoader->setMacdom($this->macdom);
$template->getLatte()->setLoader($this->fileLoader);
return $template;
}
```And add a config neon file with the following content (or try [Composer synchronizer](https://github.com/composer-synchronizer/composer-synchronizer). It will do it for you automatically).
```
extensions:
macdom: Macdom\Bridges\Nette\MacdomExtension
macdom:
debugger: TRUE
```