From e70401934bab86568e522a9e1e90e9d2fb7495b5 Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Sat, 1 Dec 2018 15:03:53 +0530 Subject: [PATCH 1/3] Update README.md --- README.md | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c3fdb1b..e2dba9d 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ becomes... ## Usage -There are two different ways to use this library. +There are three different ways to use this library. ### Option 1: Template loaders @@ -190,6 +190,50 @@ Then just include your Haml templates along with all the other files which conta python manage.py makemessages --extension haml,html,py,txt ``` + +### Option 3: IntelliJ file watcher + +Save this script @ `/scripts/compile_haml.py` + +```python +import sys + +from hamlpy.compiler import Compiler + + +with open(sys.argv[1], "r") as f: + print(Compiler().process(f.read())) +``` + +Save this as `watcher.xml`, and click import button at file watcher settings. + +After this, haml files will automatically be compiled as you type. + +```xml + + + + + +``` + ## Reference Check out the [reference](http://github.com/nyaruka/django-hamlpy/blob/master/REFERENCE.md) file for the complete syntax From 62215b9b49baf83c8a9b5d1ee67e4bf122d7240f Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Sat, 1 Dec 2018 15:13:48 +0530 Subject: [PATCH 2/3] Update README.md Add `` tags to make the readme more digestible --- README.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e2dba9d..a5f4ead 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,10 @@ becomes... There are three different ways to use this library. -### Option 1: Template loaders - +
+1. Djano template loaders +

+ These are Django template loaders which will convert any templates with `.haml` or `.hamlpy` extensions to regular Django templates whenever they are requested by a Django view. To use them, add them to the list of template loaders in your Django settings, e.g. @@ -137,8 +139,15 @@ You can configure the Haml compiler with the following Django settings: * `HAMLPY_DJANGO_INLINE_STYLE` -- Whether to support `={...}` syntax for inline variables in addition to `#{...}`. Defaults to `False`. -### Option 2: Watcher +

+
+ + +
+2. File watcher CLI +

+ The library can also be used as a stand-alone program. There is a watcher script which will monitor Haml files in a given directory and convert them to HTML as they are edited. @@ -188,10 +197,16 @@ Then just include your Haml templates along with all the other files which conta ```bash python manage.py makemessages --extension haml,html,py,txt -``` +``` +

+
+ +
+3. PyCharm file watcher +

-### Option 3: IntelliJ file watcher +This will configure your IDE to automatically compile files as-you-type. Save this script @ `/scripts/compile_haml.py` @@ -207,8 +222,6 @@ with open(sys.argv[1], "r") as f: Save this as `watcher.xml`, and click import button at file watcher settings. -After this, haml files will automatically be compiled as you type. - ```xml @@ -234,6 +247,11 @@ After this, haml files will automatically be compiled as you type. ``` +

+
+ + + ## Reference Check out the [reference](http://github.com/nyaruka/django-hamlpy/blob/master/REFERENCE.md) file for the complete syntax From ac4cded60cfeb14321fd04bf16a91bc2ec9fb99c Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Sat, 1 Dec 2018 15:14:46 +0530 Subject: [PATCH 3/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a5f4ead..b3f29e6 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ becomes... ## Usage There are three different ways to use this library. +(click to expand)
1. Djano template loaders