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

ressheet

v1.2.0

Published

A prop-based LESS-like StyleSheet for React Components

Downloads

6

Readme

React Evaluated StyleSheet, better known as RESS, is a tiny preprocessor that aims to be for React what LESS is to CSS. Highlights:

  • Easy to use and get started with
  • Light-weight, minified version is less than 1kb
  • No dependencies, built without the clutter of dependencies
  • Consistency across browsers (including the notorious Internet Explorer)
  • MIT Licensed, perfect for personal and commercial use

Showcase

Getting Started

Installation

Package could be installed via npm.

npm install ressheet --save

Import / require() Package

ES6 Import Approach:

import RESSheet from 'ressheet'

NPM / CommonJS require() Approach:

var RESSheet = require('ressheet')

Usage

RESSheet allows you to write better StyleSheets with React (Native) by using component props as CSS-like classes. Check the following title component:

import React, { Component } from 'react'
import { Text } from 'react-native'
import RESSheet from 'ressheet'

class Title extends Component {
  constructor(props) {
    super(props)
  }

  render() {
    let titleStyles = new RESSheet(this.props, {
        default: {
          fontWeight: 'bold',
          color: '#000',
          fontSize: 25,
          textAlign: 'center'
        },
        
        'h1, h2, h3, h4, h5, h6': {
          marginBottom: 12,
          fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Ubuntu', 'Helvetica Neue', sans-serif",
          textTransform: 'uppercase',

          fancy: {
            fontFamily: 'cursive',
            fontStyle: 'italic'
          }
        },

        h1: { fontSize: 30 },
        h2: { fontSize: 25 },
        h3: { fontSize: 20 },
        h4: { fontSize: 15 },
        h5: { fontSize: 10 },
        h6: { fontSize: 7 }
      })

    return <Text style={titleStyles} children={this.props.children} />
  }
}

I bet you noticed that new RESSheet(props, {...}) accepts two parameters, namely: props object and the RESSheet object. I used a class component just for demonstration, however always make sure to use stateless components where possible. Anyways, the <Title /> component could now be used as follows:

<Title>This is an ordinary title</Title>
<Title h1>This is an H1 title</Title>
<Title h2 fancy>This is a fancy H2 title</Title>
<Title h3>This is an H3 title</Title>
<Title h6>This is an H6 title</Title>

The following would then display:

Notice how RESSheet allows multi selectors in 'h1, h2, h3, h4, h5, h6': {...}. Styles specified there would affect components with any h1 - h6 props. RESSheet also features nested, styles similiar to LESS, as seen in the above demo.

Without RESSheet, the above code would've been larger. This code is valid for both, react and react-native.

Browser & Device Support

Note: RESSheet supports both react and react-native out-of-the-box, along with all major browsers as highlighted below:

| Android | IOS | Chrome | Edge | Firefox | IE | Opera | Safari| |---------|-------|--------|-------|---------|-------|-------|-------| | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |

Contributing

RESSheet is a free and open source library, and I'd appreciate any help you're willing to give - be it fixing bugs, improving documentation, or suggesting new features or enhancements.

License

RESSheet is licensed under the MIT License which makes it great for both personal and commercial use.