The scenario:
I’m developing with Less CSS on a Cake App, and I want to compile the less files client-side as they recommend in the documentation (I’m also on a git repo with several other programmers, so I want them to be editing the less files instead of the css…which gets overwritten when I recompile):
<head>
. . .
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>
. . .
</head>
The problem:
I’m storing the less files in webroot/css/lib, and the less.js file in webroot/js/vendors and I want to use the HTML helper to build the link/script tags:
<?php echo $this -> Html -> css('lib/style.less'); ?>
<?php echo $this -> Html -> script('vendors/less-1.2.1.min.js');?>
There’s no problem loading the less.js. The issue lies in that with the css helper, Cake appends ‘.css’ to the end of the path.
The solution: … ?
the html helper will check if there’s a “?” in the filename.. if there isn’t, it adds “.css” at the end:
cake/libs/view/helpers/html.php (ln. 356)
maybe you can trick the helper with something like this:
but I’m not sure if it will work… you might have to write the tag manually =P
Cheers