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.

Source Distribution

PreProGuardian-0.0.11.tar.gz (3.7 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for PreProGuardian-0.0.11.tar.gz
Algorithm Hash digest
SHA256 23612d023c4c682788abd2d90f83bf608e9d1a5ba4f79393af2fcbb63e56a2df
MD5 e3d78bd70149dac1eb7995332f085f6f
BLAKE2b-256 3d48d3bf5be03218e26ec3ef6d5e4b37d5c35fe43c3f912be3d6755b08480b15

See more details on using hashes here.

Supported by

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