elboletaire / less-cake-plugin Goto Github PK
View Code? Open in Web Editor NEW:cake: Less parser plugin for CakePHP
License: Apache License 2.0
:cake: Less parser plugin for CakePHP
License: Apache License 2.0
Hi,
I try to generate a css URL with full base.
How can I get this to work?
$this->Less->less('less/pdf.less', ['fullBase' => true]);
does not work.
thanks & regards
Dieter
When using an optional $options['cache_dir'] parameter the CSS file that gets created will be created in that directory instead of the CSS directory.
However the \Less_Cache::Get function returns the basename() of the generated file.
The result of this problem is that the filename that gets passed to $this->Html->css a basename() and the filename that gets generated by \Less_Cache::Get is inside the ['cache_dir'] directory.
There are 3 scenarios.
The $this->compile() function looks like this:
if ($cache) {
if( !isset($options['cache_dir'])){
$options['cache_dir'] =$this->cssPath;
} else if( substr( $options['cache_dir'], 0, 1 ) =='/'){
$options['cache_dir'] = WWW_ROOT . $options['cache_dir'];
} else {
$options['cache_dir'] = trim($this->cssPath, '/') . $options['cache_dir'];
}
return \Less_Cache::Get($parse, $options, $modifyVars);
}
Inside the $this->less() function looks like this:
$cache_dir = isset($options['parser']['cache_dir']) ? $options['parser']['cache_dir'] : "";
$css = $cache_dir . $this->compile($less, $options['cache'], $options['parser'], $modifyVars);
Not sure whether I can configure Less helper to remove old compiled css files.
At the moment, I have written my own tool. Would be OK for an APP but absolutely inconvenient for plugins.
$ composer require elboletaire/less-cake-plugin
Using version dev-master for elboletaire/less-cake-plugin
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: cakephp/cakephp[3.0.x-dev, 3.0.0].
- Can only install one of: cakephp/cakephp[3.0.x-dev, 3.0.0].
- elboletaire/less-cake-plugin dev-master requires cakephp/cakephp 3.0.x-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- Installation request for elboletaire/less-cake-plugin dev-master -> satisfiable by elboletaire/less-cake-plugin[dev-master].
- Installation request for cakephp/cakephp == 3.0.0.0 -> satisfiable by cakephp/cakephp[3.0.0].
Installation failed, reverting ./composer.json to its original content.
Is there any plan to support CakePHP 4? I can't upgrade my CakePHP because this package is dependent on CakePHP 3.
SourceMaps are awesome for developing using languages like LESS.
It would be great to have this option set by default when app's debug is > 1
When Html->css is called on line 157, there is no way to set options.
I've made this small change which allows for setting Html->css options.
$cssOpt = isset($options['cssopt'] )?$options['cssopt']:[];
return $this->Html->css($css,$cssOpt);
Add useful information about $modify_vars on the readme file
Hello, it's me again. :)
The CakePHP guys changed the plugin's directory in their latest commit. Now every plugin is saved into the vendor folder. So your plugin is working without problems, but only if I copy the LessHelper.php into \View\Helper directory.
If you will have some time, maybe you can look into it. :) Thanks!
Using fullBase
urls generates issues if you're using cache and your app works on both SSL and non-SSL environment.
Disabling the fullBase
setting should fix this issue.
Hi,
I have a little problem that I can't solve, when I try to pull my compiled less files in the css block, I got an error.
Here are the folders where are my files :
--webroot /
----css /
------style.css
------other.css
------less /
--------main.less
----js/
----img/
Here is the code I use :
echo $this->Html->css('less/main.less?', ['block' => true, 'rel' => 'stylesheet/less']);
echo $this->Less->fetch(); // it seems the problem comes from here
echo $this->fetch('css');
And the error :
FileError: 'http://localhost/my_project/my_project/css/less/main.less' wasn't found (404)
The correct path is, obviously, this one :
http://localhost/my_project/css/less/main.less
For a reason that I can't find, "my_project" is duplicated in the path.
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.