Giter Site home page Giter Site logo

muskanmahajan37 / compiled Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atlassian-labs/compiled

0.0 0.0 0.0 7.42 MB

A familiar and performant compile time CSS-in-JS library for React.

Home Page: https://compiledcssinjs.com

License: Apache License 2.0

TypeScript 98.95% JavaScript 0.98% Shell 0.08%

compiled's Introduction

Compiled

A familiar and performant compile time CSS-in-JS library for React.

Apache 2.0 @compiled/react PRs welcome

Get started now โžš

Usage

import { styled, ClassNames } from '@compiled/react';

// Tie styles to an element
<div css={{ color: 'purple' }} />

// Create a component that ties styles to an element
const StyledButton = styled.button`
  color: ${(props) => props.color};
`;

// Use a component where styles are not necessarily tied to an element
<ClassNames>
  {({ css }) => children({ className: css({ fontSize: 12 }) })}
</ClassNames>

Extract styles

Turn on extraction and all components styled in your app and sourced through NPM will have their runtime stripped and styles extracted to an atomic style sheet.

-import { CC, CS } from '@compiled/react/runtime';
-
-const _2 = '._syaz1q9v{color: hotpink}';
-const _ = '._1wybfyhu{font-size: 48px}';
-
export const LargeHotPinkText = () => (
-  <CC>
-   <CS>{[_, _2]}</CS>
    <span className="_syaz1q9v _1wybfyhu">Hello world</span>
-  </CC>
);
._1wybfyhu {
  font-size: 48px;
}
._syaz1q9v {
  color: hotpink;
}

See CSS extraction for more information.

Installation

Install the React package.

npm install @compiled/react

Then configure your bundler of choice or use Babel directly.

Webpack

Install the Webpack loader.

npm install @compiled/webpack-loader --save-dev

See installation for more information.

Parcel

Note
Parcel v2 is currently in pre-release which makes this transformer experimental, it may break when updating Parcel. Use with caution.

Install the Parcel v2 transformer.

npm install @compiled/parcel-transformer --save-dev

See installation for more information.

Babel

Install the Babel plugin.

npm install @compiled/babel-plugin --save-dev

See installation for more information.

Contributions

Contributions are welcomed! Please see CONTRIBUTING.md to get started.

Thanks

Chromatic

Thanks to Chromatic for providing the visual testing platform that helps us review UI changes and catch visual regressions.


Atlassian

compiled's People

Contributors

itsdouges avatar renovate[bot] avatar madou avatar pgmanutd avatar danieldelcore avatar marionebl avatar github-actions[bot] avatar dependabot[bot] avatar atlas-dst-bot avatar ankeetmaini avatar skoob13 avatar obweger avatar flexdinesh avatar gwyneplaine avatar alexreardon avatar alexytsu avatar highvoltag3 avatar jdanil avatar andarist avatar matthewcharlton avatar adevnadia avatar shuklaaastha avatar sonatard avatar vanya829 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.