Skip to content
Browse files

Added the concatSyntax property, which allows developers to change ho…

…w urls are decorated for a file concatenation api. Updated docs as well.
  • Loading branch information...
1 parent 942122d commit 03b4581ba1c95f077e68bfe44267a1aee9001610 scottjehl committed Apr 24, 2012
Showing with 15 additions and 2 deletions.
  1. +6 −0 README.md
  2. +9 −2 enhance.js
View
6 README.md
@@ -37,7 +37,13 @@ All of the Enhance api is available via `window.ejs` or just `ejs`. From `ejs`,
ejs.basepath.css = "assets/css/";
+- `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:
+ // decorate URL for a custom concatenator API
+ ejs.concatSyntax = function( url ){
+ return "/concat/" + url;
+ };
+
### Methods
View
11 enhance.js
@@ -110,13 +110,20 @@
return ( url.indexOf( ".js" ) > -1 ? ejs.loadJS : ejs.loadCSS )( url );
};
+ // concatSyntax is a function that decorates a URL in whatever way necessary for a concatenator API.
+ // To configure, just define 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
+ ejs.concatSyntax = function( url ){
+ return url + "=concat";
+ };
+
// Function for triggering the CSS and JS requests
ejs.enhance = function(){
if( ejs.jsToLoad.length ){
- ejs.load( ejs.jsToLoad.join(",") + "=concat" );
+ ejs.load( ejs.concatSyntax( ejs.jsToLoad.join(",") ) );
}
if( ejs.cssToLoad.length ){
- ejs.load( ejs.cssToLoad.join(",") + "=concat" );
+ ejs.load( ejs.concatSyntax( ejs.cssToLoad.join(",") ) );
}
};

0 comments on commit 03b4581

Please sign in to comment.
Something went wrong with that request. Please try again.