• Stars
    star
    377
  • Rank 109,598 (Top 3 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

styled-components highlighting support in IntelliJ editors

webstorm-styled-components

Discord

Support for styled-components 💅 in WebStorm

The plugin can be installed in WebStorm, IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine v2017.2 and above.

Installation

To install the plugin open the IDE Preferences | Plugins, then click Browse repositories... and search for Styled Components.

Features

With this plugin you can enjoy the full coding assistance for styled-components 💅

  • Start typing to get code completion for CSS properties and values

  • Hit Alt-Enter to see available intentions and quick-fixes

  • Start typing in the interpolation to see completion suggestions for JavaScript variables, methods and functions

  • Cmd/Ctrl-click on the JavaScript symbol to go to its definition

Configuration

To configure additional tags, search for 'styled-components' in the IDE preferences, and enter any additional tags to treat as styled components.

For example, adding a value like media will enable CodeInsight for whose tag starts with it, e.g media.tablet`padding: 20px;` , media.desktop`padding: 10px;` .

FAQ

  • Why is code inside styled-components strings highlighted green?

The IDE highlights injected language fragments by default. The highlighting can be disabled in Preferences | Editor | Color Scheme | General | Inejcted Language Fragment.

  • Why is code inside styled-components strings not reformatted?

Formatting template strings with arguments is not currently supported by the IDE. Please follow this IDE issue for updates.

  • Why am I seeing syntax errors after a template argument?

The IDE's parser tries to determine what syntax element a template string argument replaces (property, value, etc). In some cases, it may be clear from code that at runtime the template argument will be a CSS property but not possible to infer the same statically:
const getColor = () => condition ? "color: red;" : "color: white;";

styled.div`
  ${getColor()}
  padding-right: 10px
`;

In such cases, try placing a semicolon after the template argument:

styled.div`
  ${getColor()};
  padding-right: 10px
`;

Contributing to the plugin

Please report any issue with the plugin on GitHub. We welcome your pull requests.

The plugin is written in Kotlin and uses Gradle.

To start contributing

  1. Clone this repository.
  2. Open the resulting directory in a recent version of Intellij IDEA (2017.*) using 'Open project'.
  3. In the 'Import Project from Gradle' dialog, accept the default settings.
  • To run tests use test task (from the IDEA UI search for 'Execute Gradle Task' and select test or run ./gradlew test from the command line)

  • To launch IDEA with the plugin built from your current sources use runIde

  • To prepare a zip archive for deployment use buildPlugin

The project structure and dependencies are defined in build.gradle.

Useful links

License (MIT)

Copyright 2017 Hossam Saraya

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
TypeScript
39,930
star
2

polished

A lightweight toolset for writing styles in JavaScript ✨
JavaScript
7,562
star
3

awesome-styled-components

A curated list of awesome styled-components resources 💅
3,283
star
4

xstyled

A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️
MDX
2,254
star
5

jest-styled-components

🔧 💅 Jest utilities for Styled Components
JavaScript
1,577
star
6

vue-styled-components

Visual primitives for the component age. A simple port for Vue of styled-components 💅
JavaScript
1,362
star
7

styled-theming

Create themes for your app using styled-components
JavaScript
1,168
star
8

css-to-react-native

Convert CSS text to a React Native stylesheet object
JavaScript
1,117
star
9

babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
JavaScript
1,063
star
10

vscode-styled-components

Syntax highlighting for styled-components
JavaScript
911
star
11

stylelint-processor-styled-components

Lint your styled components with stylelint!
JavaScript
657
star
12

styled-components-website

The styled-components website and documentation
MDX
607
star
13

vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
Vim Script
300
star
14

comparison

Comparing different ways to style components
JavaScript
183
star
15

elm-styled

Styling your Html Elements with typed Css 💅
Elm
180
star
16

babel-plugin-polished

Compile polished helper functions at build time
JavaScript
138
star
17

styled-elements

Styled components for the DOM.
JavaScript
87
star
18

stylelint-config-styled-components

The shareable stylelint config for stylelint-processor-styled-components
JavaScript
71
star
19

spec

Design Requirements and Spec for a Component-oriented CSS Solution
61
star
20

color-schemer

A React app to help you select a color scheme, built with styled-components and polished
JavaScript
55
star
21

styled-components-codemods

Automatic codemods to upgrade your styled-components code to newer versions.
JavaScript
52
star
22

styled-components-experimentation

A place to play with things that shouldn't be in core
JavaScript
31
star
23

s-c.sh

The styled-components URL shortener!
30
star
24

styled-components-native-code-mod

JavaScript
28
star
25

styled-components.github.io

The styled-components homepage
JavaScript
22
star
26

brand

Logo and brand related materials
11
star
27

benchmark

JavaScript
9
star
28

todomvc

The Speedometer 2.0 React TodoMVC example rebuilt with styled-components
JavaScript
6
star
29

babel-plugin-styled-components-ssr

[EXPERIMENTAL]
JavaScript
2
star
30

use-styled-hook

tbd
1
star