Reputation: 294
I loaded lessphp in my wordpress theme - it's a full custom - but I do not understand why it can not correctly link the .less file.
to be clearer the current paths are these:
path:(themefolder/lessphp/lessc.inc.php)
path:(themefolder/lessphp/input.less) hemmm not working! yeaaa!
path:(themefolder/lessphp/output.css) hemmm not working!
ps. for now, I am in wamp localhost.
Into head:
<?php
//$inputPath = get_bloginfo("template_url")."/lessphp/input.less";
require "lessphp/lessc.inc.php";
$less = new lessc;
$less->checkedCompile("lessphp/input.less", "lessphp/output.css");
?>
Before writing of course I read and did everything but, nothing, I still do not understand ...
The php error is:
Fatal error: Uncaught exception 'Exception' with message 'load error: failed to find lessphp/input.less' in C:\Server\www\shape\wp-content\themes\shape\lessphp\lessc.inc.php on line 1818
How can I do??
and, is it possible to change the classic path??
thank you.
Upvotes: 0
Views: 794
Reputation: 294
THE SOLUTION:
only wamp localhost:
Change the path from bloginfo("xxx") to php dirname(FILE).
<?php
$lesspath = dirname(FILE)."\yourextrafolderpath\lessphp\lessc.inc.php";
$inputFile = dirname(FILE).'\extrafolderpath\input.less';
$outputFile = dirname(FILE).'\extrafolderpath\output.css';
require_once $lesspath; $less = new lessc;
// create a new cache object, and compile
$less->compileFile($inputFile,$outputFile);
?>
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/extrafolderpath/output.css">
Alternative way for wamp localhost & wordpress online:
<?php
$lesspath = get_parent_theme_file_path()."\yourextrafolderpath\lessphp\lessc.inc.php";
$inputFile = get_parent_theme_file_path().'\extrafolderpath\input.less';
$outputFile = get_parent_theme_file_path().'\extrafolderpath\output.css';
require_once $lesspath; $less = new lessc;
// create a new cache object, and compile
$less->compileFile($inputFile,$outputFile);
?>
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/extrafolderpath/output.css">
Tested... Work.
Upvotes: 0