Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline compressing files from 3rd party app #581

Closed
jrief opened this issue Dec 3, 2014 · 0 comments
Closed

Offline compressing files from 3rd party app #581

jrief opened this issue Dec 3, 2014 · 0 comments

Comments

@jrief
Copy link
Contributor

jrief commented Dec 3, 2014

I have a third party app which is shipped with their own scss files. During development I'd like to use django-libsass, but CSS files shall be delivered precompiled for easier deployment. Otherwise each customer would have to install libsass, which requires a C++ compiler on the production host.

Since this third party app can not run by itself, I added a manage.py script together with a minimal settings.py. Beside the usual boilerplate, this file essentially contains the following settings:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.staticfiles',
    'compressor',
    'my_app',
)

COMPRESS_ROOT = os.path.join(PROJECT_DIR, 'my_app/static')

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

COMPRESS_PRECOMPILERS = (
    ('text/x-scss', 'django_libsass.SassCompiler'),
)

COMPRESS_OFFLINE = True

With ./manage compress I'm able to convert all my scss files into css. These files then are stored below my_app/static/CACHE/css/... together with a manifest.json.

Adding

{% compress css %}<link rel="stylesheet" type="text/x-scss" href="{% static 'my_app/css/foo.scss' %}" />{% endcompress %}

to a Django template works perfectly during development: my_app/css/foo.scss is converted on the fly into a css file. But during production, I have to access the files prebuilt with ./manage compress.

Unfortunately I did not find out how to access these precompiled files on a production host. If I remove the COMPRESS_PRECOMPILERS (which is the prerequisite explained above), then the browser accesses the scss files directly, but of course that's not what I want.

And from the docs I haven't found out how to configure an app to access the precompiled files.
Any hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant