[Pkg-javascript-commits] [less.js] 137/285: move some contexts into the import manager
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit 3f38581ce31b4882ca5667e104b7faffc5eb3215
Author: Luke Page <luke.a.page at gmail.com>
Date: Mon Sep 22 20:44:01 2014 +0100
move some contexts into the import manager
---
lib/less/contexts.js | 10 +++++-----
lib/less/imports.js | 9 +++------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/lib/less/contexts.js b/lib/less/contexts.js
index 0c9b690..4092296 100644
--- a/lib/less/contexts.js
+++ b/lib/less/contexts.js
@@ -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) {
diff --git a/lib/less/imports.js b/lib/less/imports.js
index ebcfc04..d360964 100644
--- a/lib/less/imports.js
+++ b/lib/less/imports.js
@@ -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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list