mirror of
https://github.com/less/less.js.git
synced 2026-01-23 06:07:56 -05:00
move some contexts into the import manager
This commit is contained in:
@@ -11,10 +11,13 @@ var copyFromOriginal = function copyFromOriginal(original, destination, properti
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
parseEnv is 2 things
|
||||
1. a set of options
|
||||
2. The context of the current file information
|
||||
*/
|
||||
var parseCopyProperties = [
|
||||
'paths', // option - unmodified - paths to search for imports on
|
||||
'contents', // map - filename to contents of all the files
|
||||
'contentsIgnoredChars', // map - filename to lines at the begining of each file to ignore
|
||||
'relativeUrls', // option - whether to adjust URL's to be relative
|
||||
'rootpath', // option - rootpath to append to URL's
|
||||
'strictImports', // option -
|
||||
@@ -41,9 +44,6 @@ var parseCopyProperties = [
|
||||
contexts.parseEnv = function(options) {
|
||||
copyFromOriginal(options, this, parseCopyProperties);
|
||||
|
||||
if (!this.contents) { this.contents = {}; }
|
||||
if (!this.contentsIgnoredChars) { this.contentsIgnoredChars = {}; }
|
||||
|
||||
if (typeof this.paths === "string") { this.paths = [this.paths]; }
|
||||
|
||||
if (!this.currentFileInfo) {
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
var contexts = require("./contexts"),
|
||||
Parser = require('./parser/parser');
|
||||
|
||||
// Now we have one import manager per parse, can we move things from env to the import manager
|
||||
// and then move the import manager onto env (if required there - if not, keep seperate)
|
||||
|
||||
module.exports = function(environment) {
|
||||
var ImportManager = function(env) {
|
||||
this.rootFilename = env && env.filename;
|
||||
this.paths = env.paths || []; // Search paths, when importing
|
||||
this.contents = env.contents; // Holds the imported file contents
|
||||
this.contentsIgnoredChars = env.contentsIgnoredChars; // lines inserted, not in the original less
|
||||
this.contents = {}; // map - filename to contents of all the files
|
||||
this.contentsIgnoredChars = {}; // map - filename to lines at the begining of each file to ignore
|
||||
this.mime = env.mime;
|
||||
this.error = null;
|
||||
this.env = env;
|
||||
@@ -72,7 +69,7 @@ module.exports = function(environment) {
|
||||
|
||||
newEnv.currentFileInfo = newFileInfo;
|
||||
newEnv.processImports = false;
|
||||
newEnv.contents[resolvedFilename] = contents;
|
||||
parserImports.contents[resolvedFilename] = contents;
|
||||
|
||||
if (currentFileInfo.reference || importOptions.reference) {
|
||||
newFileInfo.reference = true;
|
||||
|
||||
Reference in New Issue
Block a user