Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Supporting unlimited chained @import now.

  • Loading branch information...
commit 858bf6214323e1ccfceddf92f5dbb93fcb9c8891 1 parent d6fe89f
@Paratron authored
Showing with 26 additions and 16 deletions.
  1. +25 −16 Resources/js/app.js
  2. +1 −0  Resources/js/less.js
View
41 Resources/js/app.js
@@ -410,6 +410,30 @@ var app = {
}
},
+ find_constraints: function(file_object){
+ app.debug('Finding constraints for: '+file_object);
+ var source = file_object.open().read().toString(),
+ parent = fixfile(file_object.parent()),
+ re = /@import.+?"(.+?)"/g,
+ result,
+ constraints = [],
+ path_obj;
+
+ while (result = re.exec(source)) {
+ path_obj = parent.grep(result[1]);
+ if (path_obj.exists()) {
+ constraints.push({
+ last_stamp: path_obj.modificationTimestamp(),
+ title: result[1],
+ obj: path_obj
+ });
+ constraints = constraints.concat(app.find_constraints(path_obj));
+ }
+ }
+
+ return constraints;
+ },
+
/**
* This function takes a file object of a LESS file and does the following:
* 1: Checking if the file is already indexed
@@ -450,22 +474,7 @@ var app = {
}
//We have to load the source and parse search for any imports!
- var source = file_object.open().read().toString(),
- re = /@import.+?"(.+?)"/g,
- result,
- constraints = [],
- path_obj;
-
- while (result = re.exec(source)) {
- path_obj = parent.grep(result[1]);
- if (path_obj.exists()) {
- constraints.push({
- last_stamp: path_obj.modificationTimestamp(),
- title: result[1],
- obj: path_obj
- });
- }
- }
+ var constraints = app.find_constraints(file_object);
console.log(constraints);
View
1  Resources/js/less.js
@@ -2853,6 +2853,7 @@ function createCSS(styles, sheet, lastModified) {
function xhr(url, type, callback, errback) {
//If there is no file ending, LESS assumes you are trying to include a LESS file.
+ url = url.replace(/app:\/\/com.wearekiss.simpless.open\//g, '');
app.debug('LESS XHR: '+url);
if(url.substr(-4) != '.css' && url.substr(-5) != '.less') url += '.less';
var file = fixfile(app.compiling_file.infile.parent()).grep(url);
Please sign in to comment.
Something went wrong with that request. Please try again.