Skip to content

Commit

Permalink
Merge pull request #61 from AndreasBackx/tests/jinja2
Browse files Browse the repository at this point in the history
Added tests for Jinja2.
  • Loading branch information
jrief committed May 7, 2017
2 parents 257a1ab + 60483ba commit 1b93576
Show file tree
Hide file tree
Showing 11 changed files with 349 additions and 120 deletions.
124 changes: 119 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,60 @@
# Byte-compiled / optimized / DLL files
# Created by https://www.gitignore.io/api/macos,linux,python,django,windows

### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
media

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Python ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class

# C extensions
*.so
Expand All @@ -13,11 +67,13 @@ develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -36,22 +92,80 @@ pip-delete-this-directory.txt
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# OS specific
.DS_Store
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/macos,linux,python,django,windows
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ This is covered in the [Upgrading templates documentation](https://docs.djangopr

In `yourapp/jinja2.py`:
```python
# Include this for Python 2.
from __future__ import absolute_import

from jinja2 import Environment


def environment(**kwargs):
extensions = [] if 'extensions' not in kwargs else kwargs['extensions']
extensions.append('sass_processor.jinja2.ext.SassSrc')
Expand All @@ -179,6 +183,13 @@ def environment(**kwargs):
return Environment(**kwargs)
```

If you want to make use of the `compilescss` command, then you will also have to add the following to your settings:
```python
from yourapp.jinja2 import environment

COMPRESS_JINJA2_GET_ENVIRONMENT = environment
```

## Usage

### In your Django templates
Expand Down
Loading

0 comments on commit 1b93576

Please sign in to comment.