megamahi avatar megamahi committed 8bb3d0f

Added a TG2 example

Comments (0)

Files changed (1)

 
 This module adds the ability to link LessCSS based stylesheets.
 
-More Information: `Less CSS <http://lesscss.org>`_.
+More Information on LessCSS: `Less CSS <http://lesscss.org>`_.
+
+Using TW2's LessCSS resource with TurboGears2
+=============================================
+
+Lets use LessCSS to define a simple box with rounded corners and a drop-shadow.
+
+Create a file in the public folder TG2 project called 'simple.less'.
+
+    .rounded-corners (@radius: 5px) {
+      border-radius: @radius;
+      padding: @radius;
+      -webkit-border-radius: @radius;
+      -moz-border-radius: @radius;
+    }
+
+    .round-corners {
+        .rounded-corners;
+    }
+
+
+In your TG2 base-controller (projectname/lib/base.py):
+
+    from tg import url
+    from tw2.lesscss import LessCSSLink
+
+    class SimpleLess(LessCSSLink):
+        link=url('simple.less')
+
+in the `__call__` function of BaseController add:
+
+    LessTest.inject()
+
+above the return statement.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.