Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@decisiv/babel-plugin-styled-components-references

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@decisiv/babel-plugin-styled-components-references - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.3.5](https://github.com/Decisiv/decisiv-design-system/compare/@decisiv/babel-plugin-styled-components-references@1.3.4...@decisiv/babel-plugin-styled-components-references@1.3.5) (2019-11-22)
**Note:** Version bump only for package @decisiv/babel-plugin-styled-components-references
## [1.3.4](https://github.com/Decisiv/decisiv-design-system/compare/@decisiv/babel-plugin-styled-components-references@1.3.3...@decisiv/babel-plugin-styled-components-references@1.3.4) (2019-10-16)

@@ -8,0 +16,0 @@

4

package.json
{
"name": "@decisiv/babel-plugin-styled-components-references",
"version": "1.3.4",
"version": "1.3.5",
"description": "Babel plugin to replace references to styled components inside styled-components template literals with their paths",

@@ -37,3 +37,3 @@ "license": "MIT",

"private": false,
"gitHead": "9388dcff2e3c36e5886703472e15b78bb833776e"
"gitHead": "3a4b6e3d4e760880e31811fd798546fefb6f30ff"
}

@@ -5,14 +5,15 @@ # babel-plugin-styled-components-references

The purpose of this babel plugin is to replace references to styled components
The purpose of this Babel plugin is to replace references to styled components
inside template strings with a string pattern containing the referenced styled
component's name and its path in the filesystem. Those strings uniquely identify
styled components, which is then useful when extracting the components styles
into static stylesheets. Since the strings are unique per component, they can be
easily replaced by any other string one might want as, for example, a unique css
selector that targets that component. This is easier to express with an example.
component's name and its path in the filesystem.
Extracting styles of a styled component can be done by using the SSR features of
styled-components (refer to its docs for more info). If we do that for the
following code:
Those strings uniquely identify styled components, which is then useful when
extracting the components styles into static stylesheets. Since the strings are
unique per component, they can be easily replaced by any other string one might
want, such as a unique css selector that targets that component.
Extracting styles of a styled component can be done by using the
[SSR features of styled-components](https://www.styled-components.com/docs/advanced#server-side-rendering).
If we do that for the following code...
```jsx

@@ -34,3 +35,3 @@ import { Icon } from 'some-place';

we would get something like:
...then we get something like...

@@ -51,3 +52,3 @@ ```css

where the css selector for `Icon` is unique to that specific reference in the
...where the css selector for `Icon` is unique to that specific reference in the
whole codebase. By only reading the generated stylesheet, one cannot know to

@@ -72,3 +73,3 @@ which component a selector refers to.

this then allows us to replace all the references to that component by any
This then allows us to replace all the references to that component by any
selector we want:

@@ -90,3 +91,3 @@

and by SSR rendering each component individually, we can also replace the main
And by SSR rendering each component individually, we can also replace the main
selector for that component, which could then result in something like:

@@ -93,0 +94,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc