Socket
Socket
Sign inDemoInstall

stylus

Package Overview
Dependencies
Maintainers
5
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylus

Robust, expressive, and feature-rich CSS superset


Version published
Weekly downloads
2.6M
increased by6.12%
Maintainers
5
Weekly downloads
 
Created

What is stylus?

Stylus is a robust, expressive, and feature-rich CSS preprocessor that provides a powerful and efficient way to write CSS. It supports both an indented syntax and regular CSS style. Stylus helps in writing clean and manageable stylesheets, allowing the use of variables, mixins, functions, and many other techniques that make CSS more maintainable and extendable.

What are stylus's main functionalities?

Variables

Variables in Stylus allow you to store values that can be reused throughout your stylesheet. This example defines a variable 'main-color' and applies it to the body's text color.

main-color = #333
body
  color main-color

Mixins

Mixins in Stylus are a way to create reusable sets of properties. This mixin 'border-radius' applies the border radius across different browser prefixes and is used in a button.

border-radius(radius)
  -webkit-border-radius radius
  -moz-border-radius radius
  border-radius radius

button
  border-radius(5px)

Nesting

Nesting allows you to nest your CSS selectors in a way that follows the same visual hierarchy of your HTML. This example shows how to style a navigation bar using nesting.

nav
  ul
    margin 0
    padding 0
    list-style none
  li
    display inline-block
  a
    display block
    padding 6px 12px
    text-decoration none

Functions

Functions in Stylus can be defined to perform operations and can be used throughout the stylesheet. This example defines a simple 'add' function to calculate the sum of two values, used here to set padding.

add(a, b)
  a + b

div
  padding add(10px, 5px)

Other packages similar to stylus

Keywords

FAQs

Package last updated on 13 Aug 2022

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