Browse Source

Add "gemDir" and "maxExecBuffer" config options

master
chimo 6 years ago
parent
commit
b3a2a9816c
2 changed files with 9 additions and 5 deletions
  1. +5
    -1
      main.js
  2. +4
    -4
      node/ScssDomain.js

+ 5
- 1
main.js View File

@ -7,6 +7,10 @@ define(function (require, exports, module) {
NodeDomain = brackets.getModule("utils/NodeDomain"),
ProjectManager = brackets.getModule("project/ProjectManager"),
FileSystem = brackets.getModule("filesystem/FileSystem"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
prefs = PreferencesManager.getExtensionPrefs("scsslint"),
gemDir = prefs.get("gemDir") || "",
maxExecBuffer = prefs.get("maxExecBuffer") || 200 * 1024,
scssDomain = new NodeDomain("scss", ExtensionUtils.getModulePath(module, "node/ScssDomain"));
/**
@ -27,7 +31,7 @@ define(function (require, exports, module) {
configFile = null;
}
scssDomain.exec("build", fullPath, projectRoot, configFile)
scssDomain.exec("build", fullPath, projectRoot, configFile, gemDir, maxExecBuffer)
.fail(function (err) {
return def.reject(err);
})


+ 4
- 4
node/ScssDomain.js View File

@ -7,7 +7,7 @@
var exec = require("child_process").exec;
// Run external scss-lint command
function cmdBuild(scssFile, projectRoot, configFile, callback) {
function cmdBuild(scssFile, projectRoot, configFile, gemDir, maxExecBuffer, callback) {
var configSwitch = "",
cmd;
@ -16,11 +16,11 @@
}
// Build command
cmd = "scss-lint -f JSON " + configSwitch + " \"" + scssFile + "\"";
cmd = gemDir + "scss-lint -f JSON " + configSwitch + " \"" + scssFile + "\"";
// Call external scss-lint command
// Exit codes: https://github.com/brigade/scss-lint/blob/14ea8408dbdd867f33482825d6ccb80f841fbe19/lib/scss_lint/cli.rb#L11
exec(cmd, function (error, stdout/*, stderr*/) {
exec(cmd, { maxBuffer: maxExecBuffer }, function (error, stdout/*, stderr*/) {
var message;
// These error codes are okay
@ -73,7 +73,7 @@
cmdBuild,
true,
"Runs scss linter",
["scssFile", "projectRoot"],
["scssFile", "projectRoot", "configFile", "gemDir", "maxExecBuffer"],
[{
name: "result",
type: "string",


Loading…
Cancel
Save