Skip to content

Instantly share code, notes, and snippets.

@arlodesign
Last active January 13, 2016 22:53
Show Gist options
  • Select an option

  • Save arlodesign/e2f784dca3ab8da092dd to your computer and use it in GitHub Desktop.

Select an option

Save arlodesign/e2f784dca3ab8da092dd to your computer and use it in GitHub Desktop.

Revisions

  1. arlodesign revised this gist Jan 13, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion reg_replace.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,6 @@
    "greedy": true,
    "case": false
    }
    }
    },
    "selection_only": true
    }
  2. arlodesign revised this gist Jan 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Problem

    At Sprout, we use CSSComb to sort our declarations and conform our SCSS to our [guidelines](https://gist.github.com/arlodesign/74947d4e515ec3f434f6).
    One rule that CSSComb can't enforce for us automatically, however, is a line break before a nested selector. Let's fix it.
    One rule that CSSComb can't enforce for us automatically, however, is a line break before a nested selector. Let's fix it in Sublime Text.

    ## How it works

  3. arlodesign revised this gist Jan 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Problem

    At Sprout, we use CSSComb to sort our declarations and conform our SCSS to our [guidelines](https://gist.github.com/arlodesign/74947d4e515ec3f434f6).
    One rule of ourse that CSSComb can't enforce for us automatically, however, is a line break before a nested selector. Let's fix it.
    One rule that CSSComb can't enforce for us automatically, however, is a line break before a nested selector. Let's fix it.

    ## How it works

  4. arlodesign revised this gist Jan 12, 2016. No changes.
  5. arlodesign renamed this gist Jan 12, 2016. 1 changed file with 0 additions and 0 deletions.
  6. arlodesign revised this gist Jan 12, 2016. 2 changed files with 28 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    [
    {
    "keys": ["ctrl+shift+c"],
    "command": "chain",
    "args": {
    "commands": [
    ["css_comb"],
    ["reg_replace", {"replacements": ["css_spaceout", "css_spacein"]}]
    ]
    }
    }
    ]
    16 changes: 16 additions & 0 deletions reg_replace.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    {
    "replacements": {
    "css_spaceout": {
    "find": ";\\n(\\s+[&\\-\\.#\\w:,\\>\\s\\+]+\\s+\\{)",
    "replace": ";\\n\\n\\1",
    "greedy": true,
    "case": false
    },
    "css_spacein": {
    "find": "\\n\\n\\n+",
    "replace": "\\n\\n",
    "greedy": true,
    "case": false
    }
    }
    }
  7. arlodesign created this gist Jan 12, 2016.
    12 changes: 12 additions & 0 deletions Sublime CSSComb with Line Breaks before Nested Selectors.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    ## Problem

    At Sprout, we use CSSComb to sort our declarations and conform our SCSS to our [guidelines](https://gist.github.com/arlodesign/74947d4e515ec3f434f6).
    One rule of ourse that CSSComb can't enforce for us automatically, however, is a line break before a nested selector. Let's fix it.

    ## How it works

    - Install plugin [RegReplace](https://github.com/facelessuser/RegReplace)
    - Install plugin [Chain Of Command](https://github.com/jisaacks/ChainOfCommand)
    - Merge files from this gist to your `Packages/User` directory

    Now, `CTRL-SHIFT-C` will run CSSComb _and_ add extra linebreaks before nested selectors. NEATO.