hyra / less Goto Github PK
View Code? Open in Web Editor NEWCakePHP plugin that converts your .less files to .css using only PHP
Home Page: http://www.mindthecode.com
CakePHP plugin that converts your .less files to .css using only PHP
Home Page: http://www.mindthecode.com
The new theme support assumes your app directory is one level back from webroot, this may not always be the case (and is not with mine)
Better way would be to use CAKEPHP globals ROOT and APP_DIR.
eg:
diff --git a/View/Helper/LessHelper.php b/View/Helper/LessHelper.php
index 32b2a6d..522dd94 100644
--- a/View/Helper/LessHelper.php
+++ b/View/Helper/LessHelper.php
@@ -47,11 +47,7 @@ class LessHelper extends AppHelper {
*/
private function set_theme($theme_name) {
-
- $app_root = array_filter(explode(DS, WWW_ROOT));
-
- array_pop($app_root);
- $app_root = implode(DS, $app_root);
+ $app_root = ROOT . DS . APP_DIR;
$theme_path = DS.$app_root.DS.'View'.DS.'Themed'.DS.$theme_name.DS.'webroot'.DS;
$this->lessFolder = new Folder($theme_path.'less');
CakePHP version 2.8.4
The following gave an error for "cannot find class Lessify", unsure why. Removing .Lessify from the import seemed to fix it, so I'm guessing it's something I did or didn't name properly? Who knows.
App::import('Vendor', 'Less.Lessify',
array(
'file' => 'lessphp/lessify.inc.php'
)
);
So I did this:
require_once(APP
. 'Vendor' . DS . 'lessphp/lessify.inc.php');
Both that and removing .Lessify gave me the same error, indicating I'm including this file properly. Now I get this:
"Declaration of lessify::parse() should be compatible with lessc::parse"
The library's three years old. Maybe something changed in the past three years?
Thanks so much for this awesome plugin. I was having a couple issues with it as it was not throwing any errors with my theme's css folder being unwritable. I changed a few things around so I could use the current theme's less files dynamically and use Cake's built in themePath function.
The set_theme function:
private function set_theme() {
$theme_path = App::themePath($this->theme) . 'webroot' . DS;
$this->lessFolder = new Folder($theme_path.'less');
$this->cssFolder = new Folder($theme_path.'css');
}
The first part of the css helper function:
public function css($file) {
if ($this->theme) {
$this->set_theme();
}
...
The helper doesn't need the second parameter now if a theme is being used. Hope this helps!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.