Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit 03b4581

Browse files
author
scottjehl
committedApr 24, 2012
Added the concatSyntax property, which allows developers to change how urls are decorated for a file concatenation api. Updated docs as well.
1 parent 942122d commit 03b4581

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
 

‎README.md

+6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ All of the Enhance api is available via `window.ejs` or just `ejs`. From `ejs`,
3737
ejs.basepath.css = "assets/css/";
3838
3939

40+
- `concatSyntax`: a predefined function that decorates a comma-delimited URL in whatever way necessary for a concatenator API. To configure, just redefine it as a function with a url argument, and return that url decorated any way your concatenator expects. By default, Enhance uses the url pattern suggested in the [QuickConcat project]( https://github.com/filamentgroup/quickconcat). Example:
4041

42+
// decorate URL for a custom concatenator API
43+
ejs.concatSyntax = function( url ){
44+
return "/concat/" + url;
45+
};
46+
4147

4248

4349
### Methods

‎enhance.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,20 @@
110110
return ( url.indexOf( ".js" ) > -1 ? ejs.loadJS : ejs.loadCSS )( url );
111111
};
112112

113+
// concatSyntax is a function that decorates a URL in whatever way necessary for a concatenator API.
114+
// To configure, just define it as a function with a url argument, and return that url decorated any way your concatenator expects.
115+
// by default, Enhance uses the url pattern suggested in the QuickConcat project: https://github.com/filamentgroup/quickconcat
116+
ejs.concatSyntax = function( url ){
117+
return url + "=concat";
118+
};
119+
113120
// Function for triggering the CSS and JS requests
114121
ejs.enhance = function(){
115122
if( ejs.jsToLoad.length ){
116-
ejs.load( ejs.jsToLoad.join(",") + "=concat" );
123+
ejs.load( ejs.concatSyntax( ejs.jsToLoad.join(",") ) );
117124
}
118125
if( ejs.cssToLoad.length ){
119-
ejs.load( ejs.cssToLoad.join(",") + "=concat" );
126+
ejs.load( ejs.concatSyntax( ejs.cssToLoad.join(",") ) );
120127
}
121128
};
122129

0 commit comments

Comments
 (0)
This repository has been archived.