Skip to content

flynetworks/typo3-flow-google-closure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Google Closure Package for TYPO3 Flow

Installation

I recommend to install this package using composer.
Just require the flynetworks/google-closure package in your composer.json

"require": {
    "flynetworks/google-closure": "2.*"
}

Basic Configuration

After you have the package installed there is a new configuration file "GoogleClosure.yaml" available to you.
This file has basically the following structure:

UniqueIdentifier:
  compiler:
    options:

Example

MyUniqueKey:
  compiler:
    options:
      id: 'my-project-id'
      externs:
        - 'resource://My.Package/Public/JavaScripts/Externs/SomeExterns.js'
      paths:
        - 'resource://My.Package/Public/JavaScripts/'
      moduleOutputPath: 'resource://My.Package/Public/JavaScripts/%s.min.js'
      moduleProductionUri: 'resource://My.Package/Public/JavaScripts/%s.min.js'
      modules:
        'Application':
          deps: []
          inputs:
            - 'resource://My.Package/Public/JavaScripts/Application.js'

Don't use a dot "." for the UniqueIdentifier! I recommend to use only alphanumeric characters.
Within the "options" property you can start to configure the compiler parameters.

Available compiler options:

This package is using the plovr build tool. A documentation about
the options you can use is located here: http://plovr.com/options.html
In the list below all options are listed with their corresponding type.

Option Type
id required string
inputs array[string]
paths array[string]
externs array[string]
customExternsOnly boolean
closureLibrary string
experimentalExcludeClosureLibrary boolean
mode RAW, WHITESPACE, SIMPLE, ADVANCED
level QUIET, DEFAULT, VERBOSE
inherits string
debug boolean
prettyPrint boolean
printInputDelimiter boolean
outputFile string
outputWrapper array[string]
outputCharset string
fingerprint boolean
modules object
moduleOutputPath string
moduleProductionUri string
moduleInfoPath string
globalScopeName string
define object
treatWarningsAsErrors boolean
exportTestFunctions boolean
nameSuffixesToStrip array[string]
typePrefixesToStrip array[string]
idGenerators array[string]
ambiguateProperties boolean
disambiguateProperties boolean
experimentalCompilerOptions object
customPasses object
soyFunctionPlugins array[string]
jsdocHtmlOutputPath string
variableMapInputFile string
variableMapOutputFile string
propertyMapInputFile string
propertyMapOutputFile string
testTemplate string
testExcludes array[string]

Advanced Configuration

There are some more configuration properties available to you. Just see the example below.

MyFancyConfiguration:
  embedMode: 'dependency' #Viewhelper renders the dependency version
  dependency:
    command: 'python %FLOW_PATH_PACKAGES%Application/My.Cool.Package/Resources/Public/closure/bin/build/depswriter.py'
    outputFileName: 'MyCustomDepsFileName.js'
  compiler:
    command: 'java -jar %FLOW_PATH_PACKAGES%Application/My.Cool.Package/Resources/Private/Bin/Plovr.jar build'
    
ChildConfiguration:
  embedMode: 'compiled' #Viewhelper renders the compiled version
  extends: 'MyFancyConfiguration'
  compiler:
   command: 'java -jar %FLOW_PATH_PACKAGES%Application/Super.Child.Package/Resources/Private/Bin/Plovr.jar build'

ViewHelper

Also a ViewHelper "EmbedScriptViewHelper" is available through this package :)

{namespace gc=FlyNetworks\Google\Closure\ViewHelpers}
<!DOCTYPE html>
<html>
	<head>
        <gc:embedScript configurationKey="MyFancyConfiguration" />
        <gc:embedScript configurationKey="ChildConfiguration" />        
	</head>
</html>

Commands

./flow closure:compile
./flow closure:dependency

About

Google Closure Package for TYPO3 Flow

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages