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

neatcss

v1.0.1

Published

A custom attribute-based CSS framework optimized for fast rendering and responsive design across devices.

Downloads

82

Readme

Here's a suggested README file for the NeatCSS framework with usage details, benefits, examples, and integration instructions for React, Angular, and Vue.


NeatCSS Framework

NeatCSS is a lightweight, responsive CSS framework built to simplify styling by allowing CSS properties to be applied directly via HTML attributes. Designed for rapid development, NeatCSS is ideal for projects needing efficient, responsive design control without extensive CSS files.

Features

  • Attribute-Based Styling: Use shorthand attributes to apply CSS properties directly on elements.
  • Responsive Design: Supports breakpoints for various screen sizes, from mobile (320px) to large desktop screens (1440px).
  • Dynamic Responsiveness: Automatically adapts styles based on the current viewport width.
  • Broad Property Coverage: Includes support for commonly-used CSS properties (e.g., padding, margin, background, animation, display, flex, grid, font properties).

Getting Started

Installation

You can install NeatCSS via npm:

npm install neatcss

Alternatively, include the JavaScript file directly in your project:

<script src="path-to-neatcss/neatcss.js"></script>

Basic Usage Example

With NeatCSS, you can style elements by adding attributes instead of traditional CSS selectors:

<!-- Button with padding, margin, and background color -->
<button p="15px" m="10px" bgc="#3498db" cl="#ffffff">Click Me</button>

<!-- Div with responsive margin and padding -->
<div mx-sm="20px" mx-md="30px" mx-lg="40px" px="10px" bgc="#e74c3c">
    Responsive Div
</div>

Screen Size Breakpoints

NeatCSS includes pre-defined breakpoints for responsive design. You can apply styles specific to breakpoints by adding suffixes:

| Breakpoint | Suffix | Screen Size | |------------|--------|-------------| | xs | -xs | 320px | | sm | -sm | 480px | | md | -md | 576px | | lg | -lg | 768px | | xl | -xl | 992px | | xxl | -xxl | 1200px | | xxxl | -xxxl | 1440px |

For example, to apply a padding of 20px on medium screens and 30px on large screens:

<div p-md="20px" p-lg="30px">Responsive Padding</div>

Benefits

  1. Simplified Styling: NeatCSS allows inline styling with intuitive shorthand attributes, reducing the need for external CSS classes and files.
  2. Improved Performance: By limiting the CSS selectors and using JavaScript to apply responsive styling, NeatCSS improves render times.
  3. Enhanced Responsiveness: With multiple built-in breakpoints, adapting to various screen sizes becomes seamless.
  4. Error Handling: NeatCSS includes error handling, displaying descriptive messages for unsupported styles to help debug styling issues.

Integration with JavaScript Frameworks

React Integration

To use NeatCSS in React, add neatcss.js as an import, then call applyStyles() after rendering components with NeatCSS attributes.

import React, { useEffect } from 'react';
import { applyStyles } from "neatcss";

const App = () => {
     useEffect(() => {
        applyStyles();
        window.addEventListener("resize", applyStyles);

        return () => window.removeEventListener("resize", applyStyles);
    }, []);

    return (
        <button p="15px" m="10px" bgc="#3498db" cl="#ffffff">Click Me</button>
    );
};

export default App;

Angular Integration

In Angular, import applyStyles() in your component and call it in ngAfterViewInit() to apply NeatCSS attributes after rendering.

// app.component.ts
import { Component, HostListener, OnInit, OnDestroy } from '@angular/core';
import { applyStyles } from 'neatcss';

@Component({
  selector: 'app-root',
  template: `<button p="15px" m="10px" bgc="#3498db" cl="#ffffff">Click Me</button>`,
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, OnDestroy {
  ngOnInit() {
    applyStyles();
  }

  @HostListener('window:resize', ['$event'])
  onResize() {
    applyStyles();
  }

  ngOnDestroy() {
    window.removeEventListener('resize', applyStyles);
  }
}

Vue Integration

For Vue, add neatcss.js and use the mounted lifecycle method to apply styles.

<template>
  <button p="15px" m="10px" bgc="#3498db" cl="#ffffff">Click Me</button>
</template>

<script>
import { onMounted, onBeforeUnmount } from "vue";
import { applyStyles } from "neatcss";

export default {
  name: "App",
  setup() {
    onMounted(() => {
       applyStyles();
       window.addEventListener("resize", applyStyles);
    });

    onBeforeUnmount(() => {
       window.removeEventListener("resize", applyStyles);
    });
  },
};
</script>

<style scoped>
/* Any additional styles */
</style>

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/add-components).
  3. Commit your changes.
  4. Open a pull request.

For any issues or suggestions, please submit a GitHub issue.

License

This project is licensed under the MIT License.