Comparing version 0.0.1 to 0.0.2
@@ -51,3 +51,4 @@ var fs = require('fs'); | ||
} | ||
var variable = tree.variable('@' + variableName); | ||
var evalTree = tree.eval(new less.tree.evalEnv({}, [tree])); | ||
var variable = evalTree.variable('@' + variableName); | ||
if (variable == null) { | ||
@@ -57,3 +58,4 @@ stream.emit('error', new Error('variable @' + variableName + ' is undefined')); | ||
} | ||
var evalEnv = new less.tree.evalEnv({}, [tree]); | ||
var evalEnv = new less.tree.evalEnv({}, [evalTree]); | ||
var value = variable.eval(evalEnv).value.toCSS(evalEnv); | ||
@@ -60,0 +62,0 @@ stream.push(JSON.stringify(value)); |
{ | ||
"name": "varlessify", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Browserify transform to require LESS variable values into your JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,2 +31,29 @@ var assert = require('chai').assert; | ||
it('should pull top-level less variables imported from other less files', function (done) { | ||
var definition = require('./import/definition.json'); | ||
browserify() | ||
.add('./test/import/script.js') | ||
.transform(varlessify, { file: './test/import/main.less' }) | ||
.bundle(function (err, src) { | ||
if (err) { assert.ok(false, err); } | ||
vm.runInNewContext(src, { console: { log: log(definition.expected) }}); | ||
done(); | ||
}); | ||
}); | ||
it('should pull top-level less variables imported from other less files based on the paths config', function (done) { | ||
var definition = require('./paths-config/definition.json'); | ||
browserify() | ||
.add('./test/paths-config/script.js') | ||
.transform(varlessify, { | ||
file: './test/paths-config/main.less', | ||
paths: ['./test/paths-config/mysterious-folder', './test/paths-config/magnificent-folder'] | ||
}) | ||
.bundle(function (err, src) { | ||
if (err) { assert.ok(false, err); } | ||
vm.runInNewContext(src, { console: { log: log(definition.expected) }}); | ||
done(); | ||
}); | ||
}); | ||
it('should error if no less file is specified', function (done) { | ||
@@ -33,0 +60,0 @@ browserify() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8126
23
165