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

postcss-space-between

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-space-between

postcss plugin to add vertical / horizontal spacing between direct children

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

postcss-space-between

github.actions.changeset.badge codecov.badge MIT npm.badge

Changelog

Postcss plugin to add postcss plugin to add vertical / horizontal spacing between direct children

Input

.horizontal-list {
  @space-x 40px;
}
.vertical-list {
  --vertical-spacing: 40px;
  @space-y var(--vertical-spacing);
}
.global-variant {
  /* for usage in css module or web framework that uses :global (such as svelte) */
  @gspace-x 40px;
  @gspace-y 40px;
}

Output

.horizontal-list * > * {
  margin-left: 40px;
}
.vertical-list * > * {
  margin-top: 40px;
}
:global(.global-variant * > *) {
  margin-left: 40px;
  margin-top: 40px;
}

Installation

npm install --save-dev postcss postcss-space-between

Add to your postcss config

module.exports = {
  plugins: [
+   require('postcss-space-between'),
  ],
};

Supported At Rules

At RuleDescription
@space-xAdd horizontal spacing between direct children
@gspace-xAdd horizontal spacing between direct children with :global
@space-yAdd vertical spacing between direct children
@gspace-yAdd vertical spacing between direct children with :global

Test Cases & Examples

The following table lists test cases covered by this plugin, please refer to tests for details and to test input css as examples

Test CaseDescriptionInputOutput
in media queries@media min-width: 768px { .list { @space-x 40px; } }inputoutput
with combined selector.list-1, .list2 { @space-y: 40px; }inputoutput
with postcss-nestingsection { & .list { @space-x 40px; } }inputoutput
with postcss-nestedsection { .list { @space-x 40px; } }inputoutput

Keywords

FAQs

Package last updated on 07 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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