DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: CMD Source Include

Author:Christophe Monard
Created:2010-09-15T17:52:26.190000000
Changed by:Christophe Monard
Changed:2011-03-04T15:56:23.810000000
Classification:cmd_srcinc
Description:The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ----
Keywords:CMD, Source Include, cache external source as internal, performance increase, YSlow score, GT Metrix score
Author:Christophe Monard
Email:contact@cmonard.fr
Language:en

img-1 img-2 EXT: CMD Source Include - cmd_srcinc

EXT: CMD Source Include

Extension Key: cmd_srcinc

Language: en

Keywords: CMD, Source Include, cache external source as internal, performance increase, YSlow score, GT Metrix score

Copyright 2000-2008, Christophe Monard, <contact@cmonard.fr>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

EXT: CMD Source Include 1

`Introduction 3 <#__RefHeading__542_1964983386>`_

What does it do? 3

Screenshots 3

`Users manual 4 <#__RefHeading__548_1964983386>`_

`Configuration 5 <#__RefHeading__550_1964983386>`_

Reference 5

`Known problems 6 <#__RefHeading__554_1964983386>`_

`To-Do list 7 <#__RefHeading__556_1964983386>`_

`ChangeLog 8 <#__RefHeading__558_1964983386>`_

Introduction

What does it do?

  • CMD Source Include is an alternative way to include CSS ans JS into your template. Every file you specify will be include as inline text so there is only one file for JS and one for CSS. Combined with other option such moveJsFromHeaderToFooter, removeDefaultJS = external, minifyJS and inlineStyle2TempFile. You'll be able to get a higher score with Yslow or GTMetrix and of course have a website faster to load.
  • CMD Source Include can cache external source too and use them internaly. So we didn't depend on multiple server response time.
  • You should install sourceopt to get cleaner html file.

Screenshots

As you can see, there is some optimisation we can do to improve speed

img-3

In order to get this I've configured my plateform like this :

config.inlineStyle2TempFile = 1

config.removeDefaultJS = external

config.minifyJS = 1

config.moveJsFromHeaderToFooter = 1

In the constants I've configured sourceopt like this :

sourceopt {

removeGenerator = 0

removeBlurScript = 0

removeEmptyLines = 1

removeNewLines = 1

formatHtml = 4

formatHtml.tabSize = -1

}

Users manual

  • Install the extension then define activelist of elements to include then, define there description.
  • There is a TS provided with the extension wich already include some data. You can use it to understand the way it will be used.
  • The extension must be include in page object : page.220282 = < plugin.tx_cmdsrcinc
  • Here is an example configuration:

plugin.tx_cmdsrcinc {

activeList = {$plugin.tx_cmdsrcinc.activeList}

src {

ga {

js = 1

js {

url = http://www.google-analytics.com/ga.js

cache = 1

cache_lifetime = 86400

footer = 1

}

}

t3jquery {

js = 1

js.subtype = t3jquery

}

sexyBookmark {

js = 1

js.url = EXT:sexybookmarks/res/jquery/js/sexybookmarks.js

css = 1

css.url = EXT:sexybookmarks/res/css/style.css

css.order = 30

}

websnapr {

js = 1

js.url = http://bubble.websnapr.com/{$plugin.tx_cmdsrcinc.websnapr}/

}

globalStyle {

css = 1

css.url = fileadmin/global.css

css.order = 10

}

}

}

page.220282 = < plugin.tx_cmdsrcinc

Configuration

Reference

There is the basic TS definition :

activeList

Property

activeList

Data type

String

Description

List of elements to include

Default

Constant : {$plugin.tx_cmdsrcinc.activeList}

src.xx

Property

src.xx

Data type

none

Description

Array of elements definition

Default

plugin.tx_cmdsrcinc {

activeList = ga, sexyBoormark

src {

ga { ... }

sexyBoormark { … }

}

}

And there the definition of element to include, for each we can define JS and CSS

url

Property

url

Data type

String

Description

The url or file to read (not required if subtype = t3jquery)

Default

cache

Property

cache

Data type

Bool

Description

Should the source be in TYPO3 cache? (If not defined, considered as true)

Default

1

cache_lifetime

Property

cache_lifetime

Data type

integer

Description

How low should the cache keeped, if set and external source not found (error when reading), the extension try to recover from older cache

Default

604800

order

Property

order

Data type

integer

Description

Set it to order inclusion

Default

subtype

Property

subtype

Data type

String

Description

Can actualy only be userfunc or t3jquery

Default

plugin.tx_cmdsrcinc.src {

ga {

js = 1 # 1 = included, 0 not included

js.url = http://www.google-analytics.com/ga.js

js.cache_lifetime = 86400

js.footer = 1 # 1 = js goes to footer, 0 stay in header

}

myStyle {

css = 1

css.url = fileadmin/my.css

css.order = 10

}

sexyBookmark {

css = 1

css.url = EXT:sexybookmarks/res/css/style.css

css.order = 40

css.cache_lifetime = 604800

}

}

Known problems

None at this time

To-Do list

See “User manual”

ChangeLog

  • Add footer param for JS inclusion
  • Tested for TYPO3 4.5
  • TYPO3 version dependancy change
  • Change default lifetime to 7 days
  • First release

8