npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sass-logical-properties

v1.0.1

Published

A Sass package providing logical property mixins and functions.

Downloads

14

Readme

Sass Logical Properties

A Sass package providing logical property mixins and functions. This package allows you to use CSS logical properties easily and provides utilities for working with CSS custom properties.

Features

  • Logical property mixins for margin, padding, border, and border-radius.
  • Utility functions like process-value to work with CSS variables.
  • Supports both static values and CSS custom properties.

Installation

You can install this package via npm:

npm install sass-logical-properties

Usage

To use the mixins and functions in your project, simply import the package into your Sass file.

Importing the package

@use 'sass-logical-properties' as *;

Examples

Logical Margin

Use the logical-margin` mixin to apply logical margins based on the flow of the document (left-to-right or right-to-left).

.example {
  @include logical-margin(top, 20px);  // Output: margin-block-start: 20px;
}

Logical Padding

Use the logical-padding mixin to apply logical paddings.

.example {
  @include logical-padding(left, --spacing);  // Output: padding-inline-start: var(--spacing);
}

Border Radius

You can also apply logical border-radius using the logical-border-radius mixin:

.example {
  @include logical-border-radius(top-left, 10px);  // Output: border-start-start-radius: 10px;
}

Functions

process-value

This function processes a value and automatically converts CSS custom properties from the format --value to var(--value).

.example {
  color: slp-process-value(--primary-color);  // Output: color: var(--primary-color);
}

Available Mixins

  • logical-margin($side, $value): Sets logical margin based on the side.
  • logical-padding($side, $value): Sets logical padding based on the side.
  • logical-border($side, $value): Sets logical border based on the side.
  • logical-border-style($side, $value): Sets logical border style.
  • logical-border-color($side, $value): Sets logical border color.
  • logical-border-width($side, $value): Sets logical border width.
  • logical-border-radius($corner, $value): Sets logical border radius based on the corner.

Development

If you want to work on this package locally, clone the repository and install the dependencies:

git clone https://github.com/sturobson/sass-logical-properties.git
cd sass-logical-properties
npm install

Build the package

To build the Sass files, use the following command:

npm run build

Watch for changes

To watch for changes and automatically rebuild, use the following command:

npm run watch

Contributing

Contributions are welcome! If you’d like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b my-feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add new feature').
  5. Push to the branch (git push origin my-feature-branch).
  6. Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.