pax_global_header00006660000000000000000000000064140716034510014513gustar00rootroot0000000000000052 comment=076885f5678562ffa920d8c4ca715e8dd2f67a0f django-libsass-0.9/000077500000000000000000000000001407160345100142635ustar00rootroot00000000000000django-libsass-0.9/.github/000077500000000000000000000000001407160345100156235ustar00rootroot00000000000000django-libsass-0.9/.github/ISSUE_TEMPLATE/000077500000000000000000000000001407160345100200065ustar00rootroot00000000000000django-libsass-0.9/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000004561407160345100225050ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- Please see https://github.com/torchbox/django-libsass#reporting-bugs before reporting. Any bug reports relating to a third-party CSS framework are liable to be closed without further investigation. django-libsass-0.9/.github/workflows/000077500000000000000000000000001407160345100176605ustar00rootroot00000000000000django-libsass-0.9/.github/workflows/test.yml000066400000000000000000000061341407160345100213660ustar00rootroot00000000000000name: Unit tests on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }} runs-on: ubuntu-18.04 strategy: matrix: python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9] django-version: [18, 19, 110, 111, 22, 30, 31, 32] exclude: - python-version: 2.7 django-version: 22 - python-version: 2.7 django-version: 30 - python-version: 2.7 django-version: 31 - python-version: 2.7 django-version: 32 - python-version: 3.4 django-version: 22 - python-version: 3.4 django-version: 30 - python-version: 3.4 django-version: 31 - python-version: 3.4 django-version: 32 - python-version: 3.4 django-version: 18 - python-version: 3.4 django-version: 19 - python-version: 3.4 django-version: 110 - python-version: 3.5 django-version: 30 - python-version: 3.5 django-version: 31 - python-version: 3.5 django-version: 32 - python-version: 3.6 django-version: 18 - python-version: 3.6 django-version: 19 - python-version: 3.6 django-version: 110 - python-version: 3.6 django-version: 111 - python-version: 3.6 django-version: 20 - python-version: 3.7 django-version: 18 - python-version: 3.7 django-version: 19 - python-version: 3.7 django-version: 110 - python-version: 3.7 django-version: 111 - python-version: 3.7 django-version: 20 - python-version: 3.8 django-version: 18 - python-version: 3.8 django-version: 19 - python-version: 3.8 django-version: 110 - python-version: 3.8 django-version: 111 - python-version: 3.8 django-version: 20 - python-version: 3.8 django-version: 21 - python-version: 3.8 django-version: 22 - python-version: 3.9 django-version: 18 - python-version: 3.9 django-version: 19 - python-version: 3.9 django-version: 110 - python-version: 3.9 django-version: 111 - python-version: 3.9 django-version: 20 - python-version: 3.9 django-version: 21 - python-version: 3.9 django-version: 22 steps: - uses: actions/checkout@v2 - name: setup python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install tox run: pip install tox - name: Run Tests env: TOXENV: django${{ matrix.django-version }} run: tox django-libsass-0.9/.gitignore000066400000000000000000000000641407160345100162530ustar00rootroot00000000000000*.pyc build/ dist/ django_libsass.egg-info MANIFEST django-libsass-0.9/CHANGELOG.txt000066400000000000000000000026471407160345100163240ustar00rootroot00000000000000Changelog ========= 0.9 (08.07.2021) ~~~~~~~~~~~~~~~~ * Added Django 3.1 and 3.2 support (Awais Qureshi) * Added tox and enable Github actions for testing across different Django and Python versions (Awais Qureshi) 0.8 (06.01.2020) ~~~~~~~~~~~~~~~~ * Added Django 3.0 support (Tobias Kunze, Dan Kingston) * Included LICENSE file in distribution (Dougal J. Sutherland) * Added LIBSASS_ADDITIONAL_INCLUDE_PATHS setting (Iwan Trofimtschuk) * Removed unnecessary quoting from output of `static` function 0.7 (02.05.2016) ~~~~~~~~~~~~~~~~ * Added LIBSASS_PRECISION setting (Liang-Bo Wang) 0.6 (21.11.2015) ~~~~~~~~~~~~~~~~ * Fixed call to FilterBase super for django-compressor 1.6 compatibility (Dennis Vermeulen) 0.5 (18.11.2015) ~~~~~~~~~~~~~~~~ * Added sourcemap support (Saulius Žemaitaitis) * Updated the `static` function to use the more versatile django.contrib.staticfiles implementation (Carl Johnson) 0.4 (24.08.2015) ~~~~~~~~~~~~~~~~ * Added support for custom functions (Alexandre Pocquet) * Added a `static` function to generate paths to assets such as images and fonts (Alexandre Pocquet) 0.3 (27.04.2015) ~~~~~~~~~~~~~~~~ * Enabled source comments when DEBUG is True; can be overridden with the LIBSASS_SOURCE_COMMENTS setting * Added LIBSASS_OUTPUT_STYLE setting 0.2 (22.05.2014) ~~~~~~~~~~~~~~~~ * Made compatible with django-compressor 1.4 and Python 3. 0.1 (05.03.2014) ~~~~~~~~~~~~~~~~ * Initial release. django-libsass-0.9/LICENSE000066400000000000000000000030111407160345100152630ustar00rootroot00000000000000Copyright (c) 2014 Torchbox Ltd and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Torchbox nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. django-libsass-0.9/MANIFEST.in000066400000000000000000000000201407160345100160110ustar00rootroot00000000000000include LICENSE django-libsass-0.9/README.rst000066400000000000000000000113641407160345100157570ustar00rootroot00000000000000django-libsass ============== A django-compressor filter to compile Sass files using libsass. Installation ~~~~~~~~~~~~ Starting from a Django project with `django-compressor `_ set up:: pip install django-libsass and add django_libsass.SassCompiler to your COMPRESS_PRECOMPILERS setting:: COMPRESS_PRECOMPILERS = ( ('text/x-scss', 'django_libsass.SassCompiler'), ) You can now use the content type text/x-scss on your stylesheets, and have them compiled seamlessly into CSS:: {% load compress %} {% compress css %} {% endcompress %} Imports ~~~~~~~ Relative paths in @import lines are followed as you would expect:: @import "../variables.scss"; Additionally, Django's STATICFILES_FINDERS setting is consulted, and all possible locations for static files *on the local filesystem* are included on the search path. This makes it possible to import files across different apps:: @import "myotherapp/css/widget.scss" Settings ~~~~~~~~ The following settings can be used to control django-libsass's behaviour: * ``LIBSASS_SOURCE_COMMENTS`` - whether to enable SASS source comments (adds comments about source lines). Defaults to ``True`` when Django's ``DEBUG`` is ``True``, ``False`` otherwise. * ``LIBSASS_OUTPUT_STYLE`` - SASS output style. Options are ``'nested'``, ``'expanded'``, ``'compact'`` and ``'compressed'``, although as of libsass 3.0.2 only ``'nested'`` and ``'compressed'`` are implemented. Default is 'nested'. See `SASS documentation for output styles `_. Note that `django-compressor's settings `_ may also affect the formatting of the resulting CSS. * ``LIBSASS_CUSTOM_FUNCTIONS`` - A mapping of custom functions to be made available within the SASS compiler. By default, a ``static`` function is provided, analogous to Django's ``static`` template tag. * ``LIBSASS_SOURCEMAPS`` - Enable embedding sourcemaps into file output (default: False) * ``LIBSASS_PRECISION`` - Number of digits of numerical precision (default: 5) * ``LIBSASS_ADDITIONAL_INCLUDE_PATHS`` - a list of base paths to be recognised in @import lines, in addition to Django's recognised static file locations Custom functions ~~~~~~~~~~~~~~~~ The SASS compiler can be extended with custom Python functions defined in the ``LIBSASS_CUSTOM_FUNCTIONS`` setting. By default, a ``static`` function is provided, for generating static paths to resources such as images and fonts:: .foo { background: url(static("myapp/image/bar.png")); } If your ``STATIC_URL`` is '/static/', this will be rendered as:: .foo { background: url("/static/myapp/image/bar.png")); } Why django-libsass? ~~~~~~~~~~~~~~~~~~~ We wanted to use Sass in a Django project without introducing any external (non pip-installable) dependencies. (Actually, we wanted to use Less, but the same arguments apply...) There are a few pure Python implementations of Sass and Less, but we found that they invariably didn't match the behaviour of the reference compilers, either in their handling of @imports or lesser-used CSS features such as media queries. `libsass `_ is a mature C/C++ port of the Sass engine, co-developed by the original creator of Sass, and we can reasonably rely on it to stay in sync with the reference Sass compiler - and, being C/C++, it's fast. Thanks to Hong Minhee's `libsass-python `_ project, it has Python bindings and installs straight from pip. django-libsass builds on libsass-python to make @import paths aware of Django's staticfiles mechanism, and provides a filter module for django-compressor which uses the libsass-python API directly, avoiding the overheads of calling an external executable to do the compilation. Reporting bugs ~~~~~~~~~~~~~~ Please see the `troubleshooting `_ page for help with some common setup issues. I do not provide support for getting django-libsass working with your CSS framework of choice. If you believe you've found a bug, please try to isolate it as a minimal reproducible test case before reporting it - ideally this will consist of a few edits / additions to the `hello-django-libsass `_ example project. If you cannot demonstrate the problem in a few standalone SCSS files, it is almost certainly not a django-libsass bug - any bug reports that relate to a third-party CSS framework are likely to be closed without further investigation. Author ~~~~~~ Matt Westcott matthew.westcott@torchbox.com django-libsass-0.9/django_libsass.py000066400000000000000000000127321407160345100176240ustar00rootroot00000000000000import base64 import json import re import os import django from django.conf import settings from django.contrib.staticfiles.finders import get_finders if django.VERSION >= (1,10): from django.templatetags.static import static as django_static else: from django.contrib.staticfiles.templatetags.staticfiles import static as django_static import sass from compressor.filters.base import FilterBase def static(path): """ Use the Django builtin static file resolver to return an absolute path usable as CSS url() argument. Sass equivalent of the 'static' template tag. """ return django_static(path) OUTPUT_STYLE = getattr(settings, 'LIBSASS_OUTPUT_STYLE', 'nested') SOURCE_COMMENTS = getattr(settings, 'LIBSASS_SOURCE_COMMENTS', settings.DEBUG) CUSTOM_FUNCTIONS = getattr(settings, 'LIBSASS_CUSTOM_FUNCTIONS', {'static': static}) SOURCEMAPS = getattr(settings, 'LIBSASS_SOURCEMAPS', False) PRECISION = getattr(settings, 'LIBSASS_PRECISION', None) # None use libsass default ADDITIONAL_INCLUDE_PATHS = getattr(settings, 'LIBSASS_ADDITIONAL_INCLUDE_PATHS', None) INCLUDE_PATHS = None # populate this on first call to 'get_include_paths' def get_include_paths(): """ Generate a list of include paths that libsass should use to find files mentioned in @import lines. """ global INCLUDE_PATHS if INCLUDE_PATHS is not None: return INCLUDE_PATHS include_paths = [] # Look for staticfile finders that define 'storages' for finder in get_finders(): try: storages = finder.storages except AttributeError: continue for storage in storages.values(): try: include_paths.append(storage.path('.')) except NotImplementedError: # storages that do not implement 'path' do not store files locally, # and thus cannot provide an include path pass global ADDITIONAL_INCLUDE_PATHS if ADDITIONAL_INCLUDE_PATHS: include_paths.extend(ADDITIONAL_INCLUDE_PATHS) INCLUDE_PATHS = include_paths return include_paths def prefix_sourcemap(sourcemap, base_path): decoded_sourcemap = json.loads(sourcemap) source_urls = [] include_paths = get_include_paths() for source_filename in decoded_sourcemap['sources']: # expand source_filename into an absolute file path full_source_path = os.path.normpath(os.path.join(base_path, source_filename)) # look for a path in include_paths that is a prefix of full_source_path for path in include_paths: if full_source_path.startswith(path): # A matching path has been found; take the remainder as a relative path. # include_paths entries do not include a trailing slash; # [len(path) + 1:] ensures that we trim the path plus trailing slash remainder = full_source_path[len(path) + 1:] # Invoke the 'static' template tag to turn the relative path into a URL source_urls.append(django_static(remainder)) break else: # no matching path was found in include_paths; return the original source filename # as a fallback source_urls.append(source_filename) decoded_sourcemap['sources'] = source_urls return json.dumps(decoded_sourcemap) def embed_sourcemap(output, sourcemap): encoded_sourcemap = base64.standard_b64encode( sourcemap.encode('utf-8') ) sourcemap_fragment = 'sourceMappingURL=data:application/json;base64,{} '\ .format(encoded_sourcemap.decode('utf-8')) url_re = re.compile(r'sourceMappingURL=[^\s]+', re.M) output = url_re.sub(sourcemap_fragment, output) return output def compile(**kwargs): """Perform sass.compile, but with the appropriate include_paths for Django added""" kwargs = kwargs.copy() if PRECISION is not None: kwargs['precision'] = PRECISION kwargs['include_paths'] = (kwargs.get('include_paths') or []) + get_include_paths() custom_functions = CUSTOM_FUNCTIONS.copy() custom_functions.update(kwargs.get('custom_functions', {})) kwargs['custom_functions'] = custom_functions if SOURCEMAPS and kwargs.get('filename', None): # We need to pass source_map_file to libsass so it generates # correct paths to source files. base_path = os.path.dirname(kwargs['filename']) sourcemap_filename = os.path.join(base_path, 'sourcemap.map') kwargs['source_map_filename'] = sourcemap_filename libsass_output, sourcemap = sass.compile(**kwargs) sourcemap = prefix_sourcemap(sourcemap, base_path) output = embed_sourcemap(libsass_output, sourcemap) else: output = sass.compile(**kwargs) return output class SassCompiler(FilterBase): def __init__(self, content, attrs=None, filter_type=None, charset=None, filename=None): # FilterBase doesn't handle being passed attrs, so fiddle the signature super(SassCompiler, self).__init__(content=content, filter_type=filter_type, filename=filename) def input(self, **kwargs): if self.filename: return compile(filename=self.filename, output_style=OUTPUT_STYLE, source_comments=SOURCE_COMMENTS) else: return compile(string=self.content, output_style=OUTPUT_STYLE) django-libsass-0.9/runtests.py000077500000000000000000000023141407160345100165270ustar00rootroot00000000000000#!/usr/bin/env python import argparse import os import shutil import sys import warnings from django.core.management import execute_from_command_line os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' def make_parser(): parser = argparse.ArgumentParser() parser.add_argument('--deprecation', choices=['pending', 'imminent', 'none'], default='imminent') return parser def parse_args(args=None): return make_parser().parse_known_args(args) def runtests(): args, rest = parse_args() if args.deprecation == 'pending': # Show all deprecation warnings warnings.simplefilter('default', DeprecationWarning) warnings.simplefilter('default', PendingDeprecationWarning) elif args.deprecation == 'imminent': # Show only imminent deprecation warnings warnings.simplefilter('default', DeprecationWarning) elif args.deprecation == 'none': # Deprecation warnings are ignored by default pass argv = [sys.argv[0], 'test'] + rest try: execute_from_command_line(argv) finally: from tests.settings import STATIC_ROOT shutil.rmtree(STATIC_ROOT, ignore_errors=True) if __name__ == '__main__': runtests() django-libsass-0.9/setup.cfg000066400000000000000000000000421407160345100161000ustar00rootroot00000000000000[metadata] license-file = LICENSE django-libsass-0.9/setup.py000066400000000000000000000033171407160345100160010ustar00rootroot00000000000000#!/usr/bin/env python try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='django-libsass', version='0.9', description="A django-compressor filter to compile SASS files using libsass", author='Matt Westcott', author_email='matthew.westcott@torchbox.com', url='https://github.com/torchbox/django-libsass', py_modules=['django_libsass'], license='BSD', long_description=open('README.rst').read(), classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Framework :: Django', 'Framework :: Django :: 1.8', 'Framework :: Django :: 1.9', 'Framework :: Django :: 1.10', 'Framework :: Django :: 1.11', 'Framework :: Django :: 2.0', 'Framework :: Django :: 2.1', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.0', 'Framework :: Django :: 3.1', 'Framework :: Django :: 3.2', ], install_requires=[ "django-compressor>=1.3", "libsass>=0.7.0,<1", "django-appconf==1.0.3 ; python_version<'3'", ], ) django-libsass-0.9/tests/000077500000000000000000000000001407160345100154255ustar00rootroot00000000000000django-libsass-0.9/tests/__init__.py000066400000000000000000000000001407160345100175240ustar00rootroot00000000000000django-libsass-0.9/tests/extra_static/000077500000000000000000000000001407160345100201175ustar00rootroot00000000000000django-libsass-0.9/tests/extra_static/extra.scss000066400000000000000000000000421407160345100221330ustar00rootroot00000000000000.extra-style { color: blue; } django-libsass-0.9/tests/settings.py000066400000000000000000000071301407160345100176400ustar00rootroot00000000000000""" Django settings for django_libsass tests. Generated by 'django-admin startproject' using Django 2.0.13. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'snbicjfchnkjnyhcojinbcojnghjn=*uv2e$gr5-7w2^j2y9y!' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'tests', 'compressor', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'tests.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'test-static') # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder', 'compressor.finders.CompressorFinder', ) COMPRESS_PRECOMPILERS = ( ('text/x-scss', 'django_libsass.SassCompiler'), ) LIBSASS_ADDITIONAL_INCLUDE_PATHS = [ os.path.join(BASE_DIR, 'tests', 'extra_static'), ] LIBSASS_SOURCEMAPS = True django-libsass-0.9/tests/static/000077500000000000000000000000001407160345100167145ustar00rootroot00000000000000django-libsass-0.9/tests/static/css/000077500000000000000000000000001407160345100175045ustar00rootroot00000000000000django-libsass-0.9/tests/static/css/imported.scss000066400000000000000000000000441407160345100222220ustar00rootroot00000000000000.imported-style { color: red; } django-libsass-0.9/tests/static/css/index.scss000066400000000000000000000002351407160345100215100ustar00rootroot00000000000000$background-color: #ddffdd; $foreground-color: #008800; body { background-color: $background-color; h1 { color: $foreground-color; } } django-libsass-0.9/tests/static/css/raw1.css000066400000000000000000000000441407160345100210660ustar00rootroot00000000000000.raw-style-1 { color: yellow; } django-libsass-0.9/tests/static/css/raw2.css000066400000000000000000000000431407160345100210660ustar00rootroot00000000000000.raw-style-2 { color: green; } django-libsass-0.9/tests/static/css/with_extra_include.scss000066400000000000000000000000211407160345100242530ustar00rootroot00000000000000@import 'extra'; django-libsass-0.9/tests/static/css/with_import.scss000066400000000000000000000000241407160345100227420ustar00rootroot00000000000000@import 'imported'; django-libsass-0.9/tests/static/css/with_raw_css_import.scss000066400000000000000000000000441407160345100244650ustar00rootroot00000000000000@import 'raw1.css'; @import 'raw2'; django-libsass-0.9/tests/static/css/with_static.scss000066400000000000000000000001031407160345100227150ustar00rootroot00000000000000body { background-image: url(static('images/my image.jpg')); } django-libsass-0.9/tests/templates/000077500000000000000000000000001407160345100174235ustar00rootroot00000000000000django-libsass-0.9/tests/templates/index.html000066400000000000000000000005031407160345100214160ustar00rootroot00000000000000{% load compress static %} Hello django-libsass {% compress css %} {% endcompress %}

It worked!

django-libsass-0.9/tests/tests/000077500000000000000000000000001407160345100165675ustar00rootroot00000000000000django-libsass-0.9/tests/tests/__init__.py000066400000000000000000000000001407160345100206660ustar00rootroot00000000000000django-libsass-0.9/tests/tests/test_sass.py000066400000000000000000000022101407160345100211440ustar00rootroot00000000000000import os.path from django.conf import settings from django.test import TestCase from django_libsass import compile class TestSass(TestCase): def test_invocation(self): response = self.client.get('/') self.assertEqual(response.status_code, 200) def test_import(self): result = compile(filename=os.path.join(settings.BASE_DIR, 'tests', 'static', 'css', 'with_import.scss')) self.assertIn('.imported-style', result) def test_extra_include_path(self): result = compile(filename=os.path.join(settings.BASE_DIR, 'tests', 'static', 'css', 'with_extra_include.scss')) self.assertIn('.extra-style', result) def test_raw_css_import(self): result = compile(filename=os.path.join(settings.BASE_DIR, 'tests', 'static', 'css', 'with_raw_css_import.scss')) self.assertIn('@import url(raw1.css);', result) self.assertIn('.raw-style-2', result) def test_static_function(self): result = compile(filename=os.path.join(settings.BASE_DIR, 'tests', 'static', 'css', 'with_static.scss')) self.assertIn(r'background-image: url(/static/images/my%20image.jpg);', result) django-libsass-0.9/tests/urls.py000066400000000000000000000016761407160345100167760ustar00rootroot00000000000000from __future__ import absolute_import, unicode_literals """hello_django_libsass URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ import django from tests.views import index if django.VERSION >= (2, 0): from django.urls import path urlpatterns = [ path('', index), ] else: from django.conf.urls import url urlpatterns = [ url('^$', index), ] django-libsass-0.9/tests/views.py000066400000000000000000000001431407160345100171320ustar00rootroot00000000000000from django.shortcuts import render def index(request): return render(request, 'index.html') django-libsass-0.9/tox.ini000066400000000000000000000006521407160345100156010ustar00rootroot00000000000000[tox] envlist = django{18,19,110,111,20,21,22,30,31,32} [testenv] commands = python runtests.py deps = django18: Django>=1.8,<1.9 django19: Django>=1.9,<1.10 django110: Django>=1.10,<1.11 django111: Django>=1.11,<2.0 django20: Django>=2.0,<2.1 django21: Django>=2.1,<2.2 django22: Django>=2.2a1,<3.0 django30: Django>=3.0,<3.1 django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3