mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
add option to disable javascript. Fixes #688
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
'compress', // option - whether to compress
|
||||
'processImports', // option - whether to process imports. if false then imports will not be imported
|
||||
'syncImport', // option - whether to import synchronously
|
||||
'javascriptEnabled',// option - whether JavaScript is enabled. if undefined, defaults to true
|
||||
'mime', // browser only - mime type for sheet import
|
||||
'useFileCache', // browser only - whether to use the per file session cache
|
||||
'currentFileInfo' // information about the current file - for error reporting and importing and making urls relative etc.
|
||||
|
||||
@@ -33,6 +33,7 @@ var lessc_helper = {
|
||||
sys.puts(" -M, --depends Output a makefile import dependency list to stdout");
|
||||
sys.puts(" --no-color Disable colorized output.");
|
||||
sys.puts(" --no-ie-compat Disable IE compatibility checks.");
|
||||
sys.puts(" --no-js Disable JavaScript in less files");
|
||||
sys.puts(" -l, --lint Syntax check only (lint).");
|
||||
sys.puts(" -s, --silent Suppress output of error messages.");
|
||||
sys.puts(" --strict-imports Force evaluation of imports.");
|
||||
@@ -63,9 +64,7 @@ var lessc_helper = {
|
||||
sys.puts("Report bugs to: http://github.com/cloudhead/less.js/issues");
|
||||
sys.puts("Home page: <http://lesscss.org/>");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// Exports helper functions
|
||||
for (var h in lessc_helper) { exports[h] = lessc_helper[h] }
|
||||
|
||||
@@ -790,10 +790,13 @@ less.Parser = function Parser(env) {
|
||||
javascript: function () {
|
||||
var str, j = i, e;
|
||||
|
||||
if (input.charAt(j) === '~') { j++, e = true } // Escaped strings
|
||||
if (input.charAt(j) !== '`') { return }
|
||||
if (input.charAt(j) === '~') { j++; e = true; } // Escaped strings
|
||||
if (input.charAt(j) !== '`') { return; }
|
||||
if (env.javascriptEnabled !== undefined && !env.javascriptEnabled) {
|
||||
error("You are using JavaScript, which has been disabled.");
|
||||
}
|
||||
|
||||
e && $('~');
|
||||
if (e) { $('~'); }
|
||||
|
||||
if (str = $(/^`([^`]*)`/)) {
|
||||
return new(tree.JavaScript)(str[1], i, e);
|
||||
|
||||
Reference in New Issue
Block a user