Skip to content

Commit bcc6c6b

Browse files
committed
add the usual package gunk
1 parent 1ad867f commit bcc6c6b

File tree

5 files changed

+132
-0
lines changed

5 files changed

+132
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.pyc
2+
dist/
3+
django_libsass.egg-info
4+
MANIFEST

CHANGELOG.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Changelog
2+
=========
3+
4+
0.1 (05.03.2014)
5+
~~~~~~~~~~~~~~~~
6+
* Initial release.

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2014 Torchbox Ltd and individual contributors.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of Torchbox nor the names of its contributors may be used
15+
to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
django-libsass
2+
==============
3+
4+
A django-compressor filter to compile Sass files using libsass.
5+
6+
Installation
7+
~~~~~~~~~~~~
8+
9+
Starting from a Django project with `django-compressor <https://github.com/django-compressor/django-compressor/>`_ set up::
10+
11+
pip install django-libsass
12+
13+
and add django_libsass.SassCompiler to your COMPRESS_PRECOMPILERS setting::
14+
15+
COMPRESS_PRECOMPILERS = (
16+
('text/x-scss', 'django_libsass.SassCompiler'),
17+
)
18+
19+
You can now use the content type text/x-scss on your stylesheets, and have them
20+
compiled seamlessly into CSS::
21+
22+
{% compress css %}
23+
<link rel="stylesheet" type="text/x-scss" href="{% static "myapp/css/main.scss" %}" />
24+
{% endcompress %}
25+
26+
27+
Imports
28+
~~~~~~~
29+
30+
Relative paths in @import lines are followed as you would expect::
31+
32+
@import "../variables.scss";
33+
34+
Additionally, Django's STATICFILES_FINDERS setting is consulted, and all possible locations
35+
for static files *on the local filesystem* are included on the search path. This makes it
36+
possible to import files across different apps::
37+
38+
@import "myotherapp/css/widget.scss"
39+
40+
41+
Why django-libsass?
42+
~~~~~~~~~~~~~~~~~~~
43+
44+
We wanted to use Sass in a Django project without introducing any external (non pip-installable)
45+
dependencies. (Actually, we wanted to use Less, but the same arguments apply...) There are a few
46+
pure Python implementations of Sass and Less, but we found that they invariably didn't match the
47+
behaviour of the reference compilers, either in their handling of @imports or lesser-used CSS
48+
features such as media queries.
49+
50+
`libsass <http://libsass.org/>`_ is a mature C/C++ port of the Sass engine, co-developed by the
51+
original creator of Sass, and we can reasonably rely on it to stay in sync with the reference
52+
Sass compiler - and, being C/C++, it's fast. Thanks to Hong Minhee's
53+
`libsass-python <https://github.com/dahlia/libsass-python>`_ project, it has Python bindings and
54+
installs straight from pip.
55+
56+
django-libsass builds on libsass-python to make @import paths aware of Django's staticfiles
57+
mechanism, and provides a filter module for django-compressor which uses the libsass-python API
58+
directly, avoiding the overheads of calling an external executable to do the compilation.
59+
60+
Author
61+
~~~~~~
62+
63+
Matt Westcott [email protected]

setup.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python
2+
3+
try:
4+
from setuptools import setup
5+
except ImportError:
6+
from distutils.core import setup
7+
8+
setup(
9+
name='django-libsass',
10+
version='0.1',
11+
description="A django-compressor filter to compile SASS files using libsass",
12+
author='Matt Westcott',
13+
author_email='[email protected]',
14+
url='https://github.com/torchbox/django-libsass',
15+
py_modules=['django_libsass'],
16+
license='BSD',
17+
long_description=open('README.rst').read(),
18+
classifiers=[
19+
'Development Status :: 4 - Beta',
20+
'Environment :: Web Environment',
21+
'Intended Audience :: Developers',
22+
'License :: OSI Approved :: BSD License',
23+
'Operating System :: OS Independent',
24+
'Programming Language :: Python',
25+
'Programming Language :: Python :: 2.7',
26+
'Framework :: Django',
27+
],
28+
install_requires=[
29+
"django-compressor>=1.3",
30+
"libsass>=0.3.0",
31+
],
32+
)

0 commit comments

Comments
 (0)