Skip to content

Commit 6e025bb

Browse files
Created a config file to run templates automatic
1 parent a73b586 commit 6e025bb

7 files changed

Lines changed: 14 additions & 57 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,6 @@ a.google{color:#c0392b;font-weight:700;font-family:Verdana, 'Open Sans';font-siz
6767
```js
6868
node index example myResult
6969
```
70-
A file myResult.html will be genereted in templates/example.
70+
A file myResult.html will be genereted in templates/example.
71+
72+
Your .html and .css files must be the same name of yout template path. See an example: https://github.com/alisonmonteiro/CSS-Inliner/tree/master/templates

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ if(myPath != null){
1818
try {
1919
stats = fs.lstatSync(myTemplatesPath + myPath);
2020
if (stats.isDirectory()) {
21-
22-
request(myHost + myTemplatesPath + myPath + '/' + myPath + '.php',
23-
function(err, response, body) {
2421

22+
request(myHost + myTemplatesPath + 'config.php?template=' + myPath,
23+
function(err, response, body) {
2524
if(err) console.log(err);
2625

2726
myBody = body;

templates/config.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
require __DIR__ . '/../vendor/autoload.php';
4+
5+
use Northys\CSSInliner\CSSInliner;
6+
7+
$inliner = new CSSInliner;
8+
$inliner->addCSS(__DIR__ . '/' . $_GET['template'] . '/' . $_GET['template'] . '.css');
9+
echo $inliner->render(file_get_contents(__DIR__ . '/' . $_GET['template'] . '/' . $_GET['template'] . '.html'));

templates/example/example.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

templates/example/res.html

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)