Skip to content

Instantly share code, notes, and snippets.

@exortech
Created April 4, 2012 22:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exortech/2306083 to your computer and use it in GitHub Desktop.
Save exortech/2306083 to your computer and use it in GitHub Desktop.
Naive fix for "Cannot call method 'charAt' of undefined" in Less.css
function getInput(e, env) {
if (e.filename && env.filename && (e.filename !== env.filename)) {
var baseFilename = basename(e.filename);
for (f in parser.imports.contents) {
if (parser.imports.contents.hasOwnProperty(f) && f.indexOf(baseFilename) >= 0) {
return parser.imports.contents[f];
}
}
return parser.imports.contents[baseFilename];
} else {
return input;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment