'use babel';

import {CompositeDisposable} from 'atom';
import Comb from 'csscomb';
import path from 'path';

export default {
    config: {
        projectConfigs: {
            title: 'Use project config',
            description: '.csscomb.json for example. Relative to the project directory. The details below.',
            default: '',
            type: 'string'
        },
        readyMadeConfigs: {
            title: 'Ready made configs',
            description: 'Used when you do not specify a project file. The details below.',
            type: 'string',
            default: 'yandex',
            enum: ['yandex', 'csscomb', 'zen']
        }
    },

    getSettingsConfig () {
        var cssCombPackage = atom.packages.getLoadedPackage('atom-css-comb'),
            error,
            optionsFilePath,
            projectConfigs = atom.config.get('atom-css-comb.projectConfigs'),
            projectPath = atom.project.getPaths()[0],
            readyMadeConfigs = atom.config.get('atom-css-comb.readyMadeConfigs');

        if (projectConfigs) {
            optionsFilePath = path.join(projectPath, projectConfigs);
            try {
                return require(optionsFilePath);
            } catch (_error) {
                error = _error;
                return error;
            }
        } else {
            return readyMadeConfigs || 'yandex';
        }
    },

    activate (state) {
        this.subscriptions = new CompositeDisposable();

        this.subscriptions.add(atom.commands.add('atom-workspace', {
          'css-comb:comb': () => this.comb()
        }));
    },

    comb () {
        var comb, config, filePath;
        filePath = atom.workspace.getActivePaneItem().getPath();
        config = this.getSettingsConfig();
        if (config instanceof Error) {
            return atom.notifications.addError(config.message);
        } else {
            comb = new Comb(config);
            return comb.processPath(filePath).then(function() {
                return atom.notifications.addSuccess('Css combed!');
            });
        }
    }
};

@@ -227,16 +227,61 @@
 ption: '
+Relative to the project directory. Example: %60
 .csscomb
@@ -289,75 +289,387 @@
 json
+%60
  
-f
 or 
-example. Relative to the project directory. The details below.
+%60configs/.csscomb.json%60. Leave blank if you want to use the following setting',%0A            default: '',%0A            type: 'string'%0A        %7D,%0A        commonConfigs: %7B%0A            title: 'Use common config',%0A            description: 'Put here a full path to your config. Example: %60/Users/jchouse/propjects/.csscomb.json%60. Leave blank if you want to use the following setting
 ',%0A 
@@ -864,16 +864,26 @@
 project 
+or common 
 file. Th
@@ -1310,16 +1310,92 @@
 s()%5B0%5D,%0A
+            commonConfigs = atom.config.get('atom-css-comb.commonConfigs'),%0A
         
@@ -1657,17 +1657,16 @@
  catch (
-_
 error) %7B
@@ -1686,23 +1686,166 @@
     
-error = _
+return error;%0A            %7D%0A        %7D else if (commonConfigs) %7B%0A            try %7B%0A                return require(commonConfigs);%0A            %7D catch (
 error
-;
+) %7B
 %0A   

Add ability to include full path to `csscomb.json` in settings