Skip to main content

UNKNOWN

Project description

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/"]
}

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
PreProGuardian-0.0.11.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None Mar 17, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page