tasks/build.js
function subst(str, file, dst) {
            if (dst !== undefined) {
                str = str.replace(/\{\{DST\}\}/g, dst);
            }
            var dir = path.dirname(file);
            str = str.replace(/\{\{SRC\}\}/g, file);
            var name = path.basename(file);
            str = str.replace(/\{\{NAME\}\}/g, name);
            name = name.replace(/\.\w+$/, '');
            str = str.replace(/\{\{BASENAME\}\}/g, name);
            str = str.replace(/\{\{DIR\}\}/g, dir);
            var parts =     dir.split(path.sep);
            parts.splice(0, 1);
            str = str.replace(/\{\{SUBDIR\}\}/g, path.join.apply(null, parts));
            parts.splice(0, 1);
            str = str.replace(/\{\{SUBSUBDIR\}\}/g, path.join.apply(null, parts));
            return str;
        }
function subst(str, file, dst) {
            if (dst !== undefined) {
                str = str.replace(/\{\{DST\}\}/g, dst);
            }
            var dir = path.dirname(file);
            str = str.replace(/\{\{SRC\}\}/g, file);
            var name = path.basename(file);
            str = str.replace(/\{\{NAME\}\}/g, name);
            name = name.replace(/\.\w+$/, '');
            str = str.replace(/\{\{BASENAME\}\}/g, name);
            str = str.replace(/\{\{DIR\}\}/g, dir);
            var parts =     dir.split(path.sep);
            parts.splice(0, 1);
            str = str.replace(/\{\{SUBDIR\}\}/g, path.join.apply(null, parts));
            parts.splice(0, 1);
            str = str.replace(/\{\{SUBSUBDIR\}\}/g, path.join.apply(null, parts));
            return str;
        }
function subst ( str , file , dst ) { if ( dst !== undefined ) { str = str . replace ( / \{\{DST\}\} / g , dst ) ; } var dir = path . dirname ( file ) ; str = str . replace ( / \{\{SRC\}\} / g , file ) ; var name = path . basename ( file ) ; str = str . replace ( / \{\{NAME\}\} / g , name ) ; name = name . replace ( / \.\w+$ / , '' ) ; str = str . replace ( / \{\{BASENAME\}\} / g , name ) ; str = str . replace ( / \{\{DIR\}\} / g , dir ) ; var parts = dir . split ( path . sep ) ; parts . splice ( 0 , 1 ) ; str = str . replace ( / \{\{SUBDIR\}\} / g , path . join . apply ( null , parts ) ) ; parts . splice ( 0 , 1 ) ; str = str . replace ( / \{\{SUBSUBDIR\}\} / g , path . join . apply ( null , parts ) ) ; return str ; }
Support function to substitute path variables.
Support function to substitute path variables .