Compress CSS and Javascript files of your template » DataLife Engine Support

DLEVIET - DataLife Engine Support Home Page

DataLife Engine Support » DataLife Engine » Edit Code » Compress CSS and Javascript files of your template

Compress CSS and Javascript files of your template

  • Author: admin;  
  • Views: 2484;  
  • Date: 11 March 2010;  
Dear friends

As you know, starting with version 8.5, DLE include a script - is the ability to compress javascript files, which allows reduce up to 70% their size and thus significantly speed up their load in the browser. In this article I want to tell you that this feature can be used to file your CSS style template. To do this you must change their connection to the template, let's say your styles are connected in a pattern from the point:

<link rel="stylesheet" type="text/css" href="{THEME}/css/style.css" />
<link rel="stylesheet" type="text/css" href="{THEME}/css/engine.css" />


to enable compression for these files, these lines must be replaced by:

<link rel="stylesheet" type="text/css" href="/engine/classes/min/index.php?f={THEME}/css/style.css,{THEME}/css/engine.css" />


Actually all, now your styles will be automatically merged and compressed, and the browser will be given to already compressed files, essentially saving your traffic. This will need to remember only one feature, if you want to change the contents of these files, after making changes, you should be sure to go to Admin Panel and press clean cache, and make clear their browser.

DEMO

1) Not compressed: http://dle-news.ru/templates/DLEoffsite/css/style.css (7,531 bytes)

2) Compressed: http://dle-news.ru/engine/classes/min/index.php?f=/templates/DLEoffsite/css/style.css (1,215 bytes)

Compress javascript files:

Example:
<script type="text/javascript" src="/engine/classes/min/index.php?charset=windows-1251&amp;g=general&amp;1"></script>


charset=windows-1251 : encoded file, because it may contain for example Russian text (you can change to UTF-8 or anything you want)

g=general : Group of file, it's defined in engine/classes/min/groupsConfig.php

1 (at the end) : the lifetime of cache to the next session.

Note : you can add other js files to that group.


We encourage you to Register or Login to website under your name.

Pakistan

Posted 12 March 2010 12:27 Register: 2.03.2010
Thanks. great knowledge

Pakistan

Posted 13 March 2010 01:36 Register: 2.03.2010
I didnt get about compression of javascript files. where is the src of .js file in above example?

EaS

Posted 29 March 2010 06:09 Register: 26.03.2010
in the exable you have show us a *.css compresion

not a javascript .js or part of code
winked

milton

Posted 11 August 2010 15:29 Register: 11.08.2010
GREAT! This function work whit Datalife 7.5?
Thanks!
Information
Members of Guest cannot leave comments.

Pagerank Update

    Updates Yandex SEO
    13.04.2012
    16.02.2012
    04.02.2012
    Updates Yandex search
    17.05.2012
    15.05.2012
    12.05.2012
    Updates Yandex Catalogue
    18.05.2012
    16.05.2012
    11.05.2012
    Updates Google
    03.05.2012
    06.02.2012
    08.11.2011

Find us on Facebook

Poll

How do you know DataLife Engine Support?

Search Engine
Other DLE Support websites
Forum
Friends
Others

Sponsor

Calendar

«    May 2012    »
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
Contact us in social network

Facebook

Twitter