Compiling CSS to one single CSS file

77 views
Skip to first unread message

Harold Gomez

unread,
Dec 18, 2016, 12:02:56 AM12/18/16
to Django users
Is there a way to compile multiple CSS to a single file in django.
That means if there are 10 css files it means you have 10 http requests.
But If I could compile it to one file I need one request.
Is there a wa to do this in django.
I saw collectstatic copy this to a folder(am I wrong?).

ludovic coues

unread,
Dec 18, 2016, 5:09:52 AM12/18/16
to django...@googlegroups.com
Yes, collectstatic copy static files scattered inside all your apps
inside a single directory. This make it easier to serve the files
directly from your apache or nginx or a different server from the one
you use for django.

As far as I know, django don't provide facility for turning a bunch of
CSS files into a single one. That's a front-end task and django focus
on the back-end side.

Personally, I would use a solution like sass [1] which can compile a
bunch of files into one and serve the produced file.

[1] http://sass-lang.com/
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/222887b9-50b8-48bb-a708-b3241ad94f52%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

Vijay Khemlani

unread,
Dec 18, 2016, 8:02:25 AM12/18/16
to django...@googlegroups.com
django-compressor does the job

On Sun, Dec 18, 2016 at 7:08 AM, ludovic coues <cou...@gmail.com> wrote:
Yes, collectstatic copy static files scattered inside all your apps
inside a single directory. This make it easier to serve the files
directly from your apache or nginx or a different server from the one
you use for django.

As far as I know, django don't provide facility for turning a bunch of
CSS files into a single one. That's a front-end task and django focus
on the back-end side.

Personally, I would use a solution like sass [1] which can compile a
bunch of files into one and serve the produced file.

[1] http://sass-lang.com/

2016-12-18 6:02 GMT+01:00 Harold Gomez <harold...@gmail.com>:
> Is there a way to compile multiple CSS to a single file in django.
> That means if there are 10 css files it means you have 10 http requests.
> But If I could compile it to one file I need one request.
> Is there a wa to do this in django.
> I saw collectstatic copy this to a folder(am I wrong?).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/222887b9-50b8-48bb-a708-b3241ad94f52%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages