Created a compat.js file in build/, for browser compatiblity, moved trim() in

there. LESS builds to dist/ now.
nohash
cloudhead 15 years ago
parent 41d701de1d
commit 3a474c9bae

@ -14,8 +14,8 @@ benchmark:
# Build less.js # Build less.js
# #
SRC = lib/less SRC = lib/less
BUILD = build/less.js DIST = dist/less.js
BUILD_MIN = build/less.min.js DIST_MIN = dist/less.min.js
HEADER = build/header.js HEADER = build/header.js
VERSION = `cat VERSION` VERSION = `cat VERSION`
@ -25,13 +25,13 @@ less:
${SRC}/parser.js\ ${SRC}/parser.js\
${SRC}/functions.js\ ${SRC}/functions.js\
${SRC}/tree/*.js\ ${SRC}/tree/*.js\
${SRC}/browser.js > ${BUILD} ${SRC}/browser.js > ${DIST}
@@echo ${BUILD} built. @@echo ${DIST} built.
min: less min: less
@@echo Minifying... @@echo Minifying...
@@cat ${HEADER} | sed s/@VERSION/${VERSION}/ > ${BUILD_MIN} @@cat ${HEADER} | sed s/@VERSION/${VERSION}/ > ${DIST_MIN}
@@java -jar build/compiler.jar\ @@java -jar build/compiler.jar\
--js ${BUILD} >> ${BUILD_MIN} --js ${DIST} >> ${DIST_MIN}
.PHONY: test benchmark .PHONY: test benchmark

@ -0,0 +1,5 @@
if (typeof(String.prototype.trim) !== "function") {
String.prototype.trim = function (str) {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
}

@ -1,12 +0,0 @@
if (typeof(String.prototype.trim) === "undefined") {
String.prototype.trim = function (str) {
var str = this.replace(/^\s+/, '');
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1);
break;
}
}
return str;
};
}
Loading…
Cancel
Save