Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 103 lines (77 sloc) 2.739 kb
ac748178 » LKay
2011-08-02 Changes and fixes for Kohana 3.2
1 KO3 LESS Module v.1.1.1
2 =======================
b24afeff »
2010-05-05 first commit
3
4 LESS Module is a port of Leaf Corcoran's [LESSPHP](http://leafo.net/lessphp) for Kohana 3
5 It adopts some of Alex Sancho's Kohana 2.3 Assets Module codes for CSS compression, credits goes to them
bc29934f »
2010-06-24 updated the module, added sample-code
6 Thanks to [cheeaun](http://github.com/cheeaun) for helping out!
7 You might also want to check out another implementation from [jeremeamia](http://github.com/jeremeamia/kohana-less).
b24afeff »
2010-05-05 first commit
8
9 To Use
10 -------
11 1. Put the less module folder in your Modules directory
12 2. Include less module in your application's bootstrap: 'less' => MODPATH.'less'
13 3. Copy the less config file from /modules/less/config/less.php to your application's config directory
bc29934f »
2010-06-24 updated the module, added sample-code
14 4. From your less.php config file, put the 'path' to where you want the CSS files compiled / compressed, the folder must be writable
15 5. You can set 'compress' to TRUE on your less.php config file if you want your CSS files to be combined in to one file and compressed (to lessen server calls)
b24afeff »
2010-05-05 first commit
16
17 Sample Code
18 ------------
cbe2fa47 »
2010-05-19 updated README to show less.php config example
19
1b0ec9b8 » LKay
2011-08-02 Fix
20 Default less files extension is set in `Less::$extension` and is `.less`.
cbe2fa47 »
2010-05-19 updated README to show less.php config example
21
22
bc29934f »
2010-06-24 updated the module, added sample-code
23 ** MODPATH/baseModule/media/css/layout.less **
b24afeff »
2010-05-05 first commit
24
25 @bodyBkgColor: #EEE;
26
27 body {
28 background: @bodyBkgColor;
bc29934f »
2010-06-24 updated the module, added sample-code
29 margin:0;
30 padding:0;
b24afeff »
2010-05-05 first commit
31
32 h1 { font-size: 3em; }
33 }
34
bc29934f »
2010-06-24 updated the module, added sample-code
35 ** APPPATH/media/css/style.less **
36
37 @divBkgColor: #DDD;
38
39 .roundedCorners (@radius:8px) {
40 -moz-border-radius:@radius;
41 -webkit-border-radius:@radius;
42 border-radius:@radius;
43 zoom:1;
44 }
45
46 div {
47 background: @divBkgColor;
48 .roundedCorners;
49
50 p { .roundedCorners(5px); }
51 }
52
cbe2fa47 »
2010-05-19 updated README to show less.php config example
53 ** APPPATH/config/less.php **
54
55 return array(
56 // relative PATH to a writable folder to store compiled / compressed css
57 // path below will be treated as: DOCROOT . 'media/css/'
58 'path' => 'media/css/',
bc29934f »
2010-06-24 updated the module, added sample-code
59 'compress' => TRUE,
cbe2fa47 »
2010-05-19 updated README to show less.php config example
60 );
61
ac748178 » LKay
2011-08-02 Changes and fixes for Kohana 3.2
62 ** In your controller **
b24afeff »
2010-05-05 first commit
63
bc29934f »
2010-06-24 updated the module, added sample-code
64 class Controller_Sample extends Controller_Template {
b24afeff »
2010-05-05 first commit
65
66 public $template = 'template';
cbe2fa47 »
2010-05-19 updated README to show less.php config example
67
ac748178 » LKay
2011-08-02 Changes and fixes for Kohana 3.2
68 public function action_example1()
b24afeff »
2010-05-05 first commit
69 {
bc29934f »
2010-06-24 updated the module, added sample-code
70 // no need to add .less extension
71 // you can put your less files anywhere
72 $less_files = array
73 (
ac748178 » LKay
2011-08-02 Changes and fixes for Kohana 3.2
74 MODPATH.'baseModule/media/css/layout.less',
bc29934f »
2010-06-24 updated the module, added sample-code
75 APPPATH.'media/css/style',
76 );
77
78 $this->template->stylesheet = Less::compile($less_files);
b24afeff »
2010-05-05 first commit
79 }
ac748178 » LKay
2011-08-02 Changes and fixes for Kohana 3.2
80
81 public function action_example2()
82 {
83 // you can pass just single file
84
85 $this->template->stylesheet = Less::compile(APPPATH.'media/css/style');
86 }
b24afeff »
2010-05-05 first commit
87 }
88
ac748178 » LKay
2011-08-02 Changes and fixes for Kohana 3.2
89 ** In your template **
b24afeff »
2010-05-05 first commit
90
91 <html>
92 <head>
93 <title>LESS for Kohana</title>
bc29934f »
2010-06-24 updated the module, added sample-code
94 <?= $stylesheet; // will give me ONE compressed css file located in /media/css/ ?>
b24afeff »
2010-05-05 first commit
95 </head>
96 <body>
97 <h1>LESS for Kohana or Kohana for LESS?</h1>
98 </body>
99 </html>
100
101 Issues
102 -------
18624ccf » Mon
2011-08-04 Updated README
103 Please report it to the [issues tracker](http://github.com/mongeslani/kohana-less/issues)..
Something went wrong with that request. Please try again.