All Projects β†’ nyancss β†’ Nyancss

nyancss / Nyancss

🌈 Write plain CSS while reaping benefits of CSS-in-JS

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nyancss

Preact Boilerplate
🎸 Ready-to-rock Preact starter project, powered by Webpack.
Stars: ✭ 959 (+76.29%)
Mutual labels:  webpack, preact, css-modules
React Ssr Starter
All have been introduced React environment
Stars: ✭ 20 (-96.32%)
Mutual labels:  webpack, styled-components, preact
React Redux Boilerplate
Awesome React Redux Workflow Boilerplate with Webpack 4
Stars: ✭ 307 (-43.57%)
Mutual labels:  webpack, css-modules
Kratos Boilerplate
πŸ”₯ A simple boilerplate for creating statics PWA using Webpack, Pug, PostCSS and CSS Modules
Stars: ✭ 308 (-43.38%)
Mutual labels:  webpack, css-modules
Reshadow
Markup and styles that feel right
Stars: ✭ 343 (-36.95%)
Mutual labels:  preact, css-modules
React Bolt
⚑ The most simple & robust boilerplate for your React projects.
Stars: ✭ 298 (-45.22%)
Mutual labels:  webpack, styled-components
Seek Style Guide
Living style guide for SEEK, powered by React, webpack, CSS Modules and Less.
Stars: ✭ 302 (-44.49%)
Mutual labels:  webpack, css-modules
Typescript Plugin Styled Components
TypeScript transformer for improving the debugging experience of styled-components
Stars: ✭ 330 (-39.34%)
Mutual labels:  webpack, styled-components
mediocre-pictures
Helping you take mediocre pictures, hands-free. πŸ“·πŸ™†πŸ»πŸ™…πŸΎπŸ’πŸΌπŸ“Έ
Stars: ✭ 16 (-97.06%)
Mutual labels:  preact, styled-components
Esri Loader
A tiny library to help load ArcGIS API for JavaScript modules in non-Dojo applications
Stars: ✭ 400 (-26.47%)
Mutual labels:  webpack, preact
Neutrino
Create and build modern JavaScript projects with zero initial configuration.
Stars: ✭ 3,844 (+606.62%)
Mutual labels:  webpack, preact
Sku
Front-end development toolkit
Stars: ✭ 403 (-25.92%)
Mutual labels:  webpack, css-modules
Ssr Sample
A minimum sample of Server-Side-Rendering, Single-Page-Application and Progressive Web App
Stars: ✭ 285 (-47.61%)
Mutual labels:  webpack, styled-components
11tyby
Simple 11ty setup using TypeScript, SASS, Preact with partial hydration, and other useful things. Aims to provide the DX of Gatsby, but using 11ty!
Stars: ✭ 38 (-93.01%)
Mutual labels:  preact, css-modules
Styled Components Website
The styled-components website and documentation
Stars: ✭ 513 (-5.7%)
Mutual labels:  styled-components, preact
desvg
πŸŒ… Converts SVG files into components 🌞
Stars: ✭ 79 (-85.48%)
Mutual labels:  preact, styled-components
Instapy Gui
gui for instapy automation
Stars: ✭ 313 (-42.46%)
Mutual labels:  webpack, preact
Styled Breakpoints
Simple and powerful tool for creating breakpoints in styled components and emotion. πŸ’…
Stars: ✭ 428 (-21.32%)
Mutual labels:  styled-components, preact
linaria-styled
Zero-runtime CSS in JS library for building React components
Stars: ✭ 17 (-96.87%)
Mutual labels:  styled-components, css-modules
YASCC
Yet Another SoundCloud Client
Stars: ✭ 30 (-94.49%)
Mutual labels:  preact, styled-components

🌈 Nyan CSS

Best of both worlds. Nyan CSS lets you write plain CSS while reaping benefits of CSS-in-JS.

Write a universal design system. You can reuse the same code anywhere starting from static HTML+CSS and ending with React and Vue.js without actually changing the CSS.

Minimalistic. BEM-inspired Nyan CSS convention consists just of 3 rules but it as bulletproof as BEM.

Use modern CSS. CoffeeScript long gone from the radars, yet we all loved it ;-) Stick to the platform to ensure the longevity of your code.

Skip to the convention | Join the community

Installation

See installation instructions for webpack.

Demo

CSS

.Header,
.Text {
  font-family: monospace;
}

.Header {
  font-size: 2rem;
}

.Header-size-large {
  font-size: 2.2rem;
}

.Text-italic {
  font-style: italic;
}

React code

See other options:

import React from 'react'
import { Header, Text } from './style.css'

function Announcement() {
  return (
    <>
      <Header tag="h1" size="large">
        Welcome Nyan CSS!
      </Header>
      <Text tag="marquee" italic>
        Please, welcome Nyan CSS!
      </Text>
    </>
  )
}

Result

A page in a browser with large "Welcome Nyan CSS" and moving italic "Please, welcome Nyan CSS!"

Other options

Show all options

Plain HTML

<h1 class="Header Header-size-large">
  Welcome Nyan CSS!
</h1>

<marquee class="Text Text-italic">
  Please, welcome Nyan CSS!
</marquee>

Vue.js

import Vue from 'vue'
import { Header, Text } from './style.css'

const Announcement = {
  components: {
    'custom-header': Header,
    'custom-text': Text
  },

  template: `
    <main>
      <custom-header tag='h1' size='large'>Welcome Nyan CSS!!</custom-header>
      <custom-text tag='marquee' italic='true'>Please, welcome Nyan CSS!</custom-text>
    </main>
  `
}

Preact

import { h } from 'preact'
import { Header, Text } from './style.css'

function Announcement() {
  return (
    <>
      <Header tag="h1" size="large">
        Welcome Nyan CSS!
      </Header>
      <Text tag="marquee" italic>
        Please, welcome Nyan CSS!
      </Text>
    </>
  )
}

Class names

import { Header, Text } from './style.css'

function Announcement() {
  return `
<h1 class='${Header({ size: 'large' })}'>Welcome Nyan CSS!</h1>
<marquee class='${Text({
    italic: true
  })}'>Please, welcome Nyan CSS!</marquee>
`
}

Convention

Component

.Component is a component class.

The name must be in ClassCase, e.g. .FormInput or .UI.

In this example, .Button represents <Button />.

.Button {
  color: white;
}

Boolean prop

.Component-disabled is a boolean prop class.

The name extension must be in camelCase, e.g. .FormInput-autoFocus or .UI-dev.

.Button-disabled {
  opacity: 0.5;
}

In the example, .Button-disabled is applied to the component when its disabled prop is truthy:

<Button tag="button" disabled>
  Whatever
</Button>

Enum prop

.ComponentName-color-gray is an enum prop class.

The name extensions must be in camelCase, e.g. .FormInput-borderColor-lightGray or .UI-env-dev.

.Button-color-red {
  background: red;
}

.Button-color-green {
  background: green;
}

.Button-color-red is applied to the component when its color prop equals "red":

<Button tag="button" color="red">
  Click Me
</Button>

Related packages

Changelog

See the changelog.

License

MIT Β© Sasha Koss

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].