I
I
Igor2015-11-26 23:36:37
JavaScript
Igor, 2015-11-26 23:36:37

Does the order in which mixins are included in JADE matter?

Hello!
There is a project on gulp + jade, at first everything went smoothly, but now the project has grown and the assembly of html from jade has become very slow. There are already 26 files in the project, and there will be 3-4 more times. Accordingly, there are many mixins. One mixin - one file. There is a default-layout, in which I include one common file with all mixins, for example
mixins.jade
and it already
includes mixins/svg
include mixins/main_filter
include mixins/left_popup_links
include mixins/footer_links
include mixins/breadcrumbs
include mixins/info_msg
include mixins/easy_buy
include mixins/news
include mixins/news_inner
include mixins/show_more
... and many more mixins.
Thus, it turns out that any page that inherits from default-layout already receives all this baggage of mixins, although not all of them will be used on every page. On some pages, only 2-3 mixins are used from what is written in mixins.jade.
I wanted to ask knowledgeable people: is it worth connecting all available mixins with one file at the layout level, or is it better to connect mixins that are strictly necessary for each specific page so that there is nothing superfluous? Can this affect the speed of compiling jade templates to html?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Khokhlov, 2015-11-27
@Igorilla

Asked a similar question How to quickly compile jade?
So far, I have come to connecting mixins only where they are needed and using caching.
In a large project, it’s still rotten, I suspect that there is still room for optimizing the collector itself. While there is no time to go deep, I threw RAM up to 16, it became more cheerful

D
Dmitry Kravchenko, 2015-11-27
@mydearfriend

This affects the speed to a large extent, you can verify this by spreading the mixins to the necessary files.
I ran into the same problem, on stackoverflow people write that jade was not originally sharpened for speed .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question