MCPcopy
hub / github.com/csscomb/csscomb.js / getConfig

Function getConfig

src/cli.js:101–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99}
100
101function getConfig() {
102 var configPath = options.config &&
103 path.resolve(process.cwd(), options.config) ||
104 Comb.getCustomConfigPath();
105
106 var config;
107 if (!fs.existsSync(configPath)) {
108 config = require('../config/csscomb.json');
109 } else if (configPath.match(/\.css$/)) {
110 config = Comb.detectInFile(configPath);
111 } else {
112 config = Comb.getCustomConfig(configPath);
113 }
114
115 if (!config) {
116 const errorMessage = Errors.configParsingError(configPath);
117 process.stderr.write(errorMessage);
118 process.exit(1);
119 }
120
121 applyTemplate(config);
122 if (options.verbose) config.verbose = options.verbose;
123 if (options.lint) config.lint = options.lint;
124
125 return config;
126}
127
128function applyTemplate(config) {
129 if (!config.template) return;

Callers 1

cli.jsFile · 0.85

Calls 1

applyTemplateFunction · 0.85

Tested by

no test coverage detected