1.4.0 • Published 2 years ago

one-spaces v1.4.0

Weekly downloads
102
License
MIT
Repository
-
Last release
2 years ago

One Spaces

A tiny module for making className 😎
We are striving for the best performance and lightweight.
Please check our benchmark result!!!

Installation

npm (commonjs)

npm install one-spaces

browser (iife)

Please download this file.
And embed script tag in your document.

<script src="./dist/one-spaces.js"></script>

Example

VanillaJS

var el = document.getElementById("my-element");

// arguments
el.className = spaces("cls1", "cls2", "cls3");
// array
el.className = spaces(["cls1", "cls2"], ["cls3"]);
// exclude falsy
el.className = spaces(
  "cls1",
  null,
  "cls2",
  false && "none",
  true && "cls3",
  []
);
// mix
el.className = spaces(["cls1", "cls2"], null, "cls3");
// without one-spaces
el.className = "cls1 cls2" + " cls3";

React (jsx)

import React, { useState } from "react";
import spaces from "one-spaces";
import styles from "./Page.css";

export default () => {
  const [isActive, setActive] = useState(false);
  return (
    <div className={styles.container}>
      <span className={spaces(styles.text, isActive && styles.active)}>
        Hello React!
      </span>
      <button onClick={() => setActive(!isActive)}>Toggle</button>
    </div>
  );
};

Angular & Vue

Angular and Vue have their own system for className.
Of course you can use this module with them but not recommended.

1.4.0

2 years ago

1.3.9

2 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.1.6

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.8.1

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.5.1

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago