All Projects → ardcore → atom-html-to-css

ardcore / atom-html-to-css

Licence: MIT license
atom.io plugin: generate css from html structure

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to atom-html-to-css

Atom Sloc
Atom SLOC package for the statusbar
Stars: ✭ 10 (-52.38%)
Mutual labels:  atom-package
Atom Terminal Panel
Advanced terminal interface for Atom editor
Stars: ✭ 95 (+352.38%)
Mutual labels:  atom-package
Midi Controller Css
Use Korg NanoKontrol midi controller to physically edit your CSS files, as featured in the German press:
Stars: ✭ 149 (+609.52%)
Mutual labels:  atom-package
Github
Git and GitHub integration for Atom
Stars: ✭ 880 (+4090.48%)
Mutual labels:  atom-package
Atom I18n
:atom: One Atom i18n Package for Any Locale 🌏 🌎 🌍
Stars: ✭ 56 (+166.67%)
Mutual labels:  atom-package
Atom Esformatter
Beautify JavaScript
Stars: ✭ 113 (+438.1%)
Mutual labels:  atom-package
Mighty React Snippets
Crafty React & Redux snippets for Atom Editor
Stars: ✭ 16 (-23.81%)
Mutual labels:  atom-package
Atom Elmjutsu
A bag of tricks for developing with Elm. (Atom package)
Stars: ✭ 197 (+838.1%)
Mutual labels:  atom-package
Tabnine
AI Code Completions
Stars: ✭ 8,863 (+42104.76%)
Mutual labels:  atom-package
Atom React Snippets
esnext React snippets
Stars: ✭ 146 (+595.24%)
Mutual labels:  atom-package
Envy
Text editing supercharger
Stars: ✭ 35 (+66.67%)
Mutual labels:  atom-package
Atom File Types
Specify additional file types for languages.
Stars: ✭ 54 (+157.14%)
Mutual labels:  atom-package
Markdown Themeable Pdf
ARCHIVED. NOT MAINTAINED. Themeable Markdown Converter (Print to PDF, HTML, JPEG or PNG)
Stars: ✭ 130 (+519.05%)
Mutual labels:  atom-package
Color Indent
Use colors to show in a non intrusive manner different indentation levels.
Stars: ✭ 11 (-47.62%)
Mutual labels:  atom-package
Split Diff
Side-by-side file compare for the Atom text editor.
Stars: ✭ 188 (+795.24%)
Mutual labels:  atom-package
Vuejs Snippets
Collection of Vuejs 2.0+ snippets
Stars: ✭ 17 (-19.05%)
Mutual labels:  atom-package
Git Blame
Plugin for Atom Editor. Toggle git-blame annotations for the current file in the gutter.
Stars: ✭ 96 (+357.14%)
Mutual labels:  atom-package
Highlight Selected
Highlights the current word selected when double clicking
Stars: ✭ 244 (+1061.9%)
Mutual labels:  atom-package
Particle Dev
Particle Dev package for Atom
Stars: ✭ 188 (+795.24%)
Mutual labels:  atom-package
Atom Terminal Tab
Simple terminal for the Atom text editor.
Stars: ✭ 134 (+538.1%)
Mutual labels:  atom-package

atom html-to-css package

Generates CSS boilerplate based on the selected HTML.

  • Only cares about classes, ignores id's/other possible selectors
  • Supports CSS, SCSS, Sass, LESS and possibly other syntaxes
  • BEM support (actually, more like a BE support for now. Modifiers support will be added if needed)
  • Configurable nesting, grouping and formatting
  • "Supports" JSX (recognizes the className attribute)
  • Is forgiving (meaning it should work even with invalid HTML code)

demo

atom html to css

settings

BEM grouping

key: html-to-css.bem-group, type: boolean, default: false

Should BEM-style declarations be grouped and nested in a SCSS-style?

When true:

<section class="introduction">
  <h1 class="introduction__header"></h1>
  <p class="introduction__text"></p>
</section>

.introduction {

	&__header {

	}

	&__text {

	}

}

When false, the same HTML code becomes:

.introduction {

}

.introduction__header {

}

.introduction__text {

}

BEM separator token

key: html-to-css.bem-separator, type: string, default: __

Character(s) used as a BLOCK*__*ELEMENT separator in BEM.

rulelist open token

key: html-to-css.rulelist-open, type: string, default: {\n\n

Character(s) to output when opening rulelists (including whitespaces)

rulelist close token

key: html-to-css.rulelist-close, type: string, default: }\n\n

Character(s) to output when opening rulelists (including whitespaces)

You can change them to fine-tune the output format to your own liking. Just remove { and } to support SASS-like indented syntax.

Grouping character

key: html-to-css.grouping-character, type: string, default: &

Character(s) to be used in output when referring to the parent element while nesting declarations SCSS-style.

key bindings

To avoid conflicts and promote peace, this package doesn't register any keys by default. Do it yourself, or just paste the following lines in ~/.atom/keymap.cson:

'atom-text-editor':
  'alt-x': 'html-to-css:generate'

It'll try to register alt+x key shortcut.

indentation

\t is used to indent, but Atom seems to be clever enough to convert it to your default style when pasting. Let me know if it's not doing that.

parsing

due to the forgiving nature of the excellent htmlparser2 used under the hood, this plugin is able to deal with:

  • incomplete selections (wouldn't it be faster if you could select opening tags only? well, you can)
  • not-really-valid-HTML-code (JSX, anyone?)
  • general mess (really. you can hit cmd+a in this markdown file and it'll still parse the few HTML lines from the code sample)

TODO

  • extend it with different transformers/formatters as settings.

Contributions welcomed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].