Skip to main content
PreProGuardian is a class that allows you to run multiple preprocessor compilation watchers with one python class
(and one config file and some luck).

## Supported preprocessors stack:

SASS
Jade
Coffee

Will be extended (maybe) later, since I use it for my own projects, and will add watchers as soon as they're needed.

Needless to say, PreProGuard assumes that you have cli utilites for each of preprocessors installed.
(npm install coffeescript, npm install jade, npm install sass)

## Usage:

```
from ppguard import Guardian
g = Guardian("path/to/config.json")
g.run()
```

## Folders structure:

PreProGuardian assumes that you have two main folders - one for sources (option 'sources_root') and one
for results (option 'static_root').

For each folder in sources dir there must be one in results, but not vice versa - you can have any number
of folders and files existing only in results/.

If option 'consistency_check' is set to 1 it will ask if you want to create in compiled files folder any folders that
exists only in source folder. For example: you can create folder "stylesheets" only in sources/ dir,
and if consistency_check is set to 1, on the first run script will ask if you want to create results/stylesheets/.

## Folders to watch

config options 'sass', 'jade' and 'coffee' consists of lists of folders with respect to sources_root where
PreProGuard can find source files.

## Django management command.

I use ppguard in my django projects, with following code:

app_name/management/commands/preprocessors.py:
```
from django.core.management.base import BaseCommand
from ppguard import Guardian

class Command(BaseCommand):
def handle(self, *args, **options):
g = Guardian("/path/to/config.json")
g.run()
```
python manage.py preprocessors

:)


## Misc

It is possible (since v. 0.0.4) to pass variables to jade. You can pass them using 'jade-options' config,
and then use in your templates via #{fieldName}.

Sample config file:

{
"sources_root" : "static-sources/",
"static_root" : "static/",
"jade-options" : {"some": "Dict object", "to": "Pass into templates :)"},
"consistency_check" : 1,
"sass": ["app/styles/", "stylesheets/"],
"jade": ["app/partials/", "templates/"],
"coffee": ["app/controllers/", "app/directives/", "jquery-widgets/"]
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PreProGuardian-0.0.9.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file PreProGuardian-0.0.9.tar.gz.

File metadata

File hashes

Hashes for PreProGuardian-0.0.9.tar.gz
Algorithm Hash digest
SHA256 648487771458369b9efb3cdd447dc90b95681a6b014bab4b26962d39f51d362b
MD5 d80a3a1bf260f368a1b3a0b17680f4fa
BLAKE2b-256 ad00352773ce850c4503cd9962c94fc482224d06998adecaf002b611959b9058

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page