Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-to-js-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-to-js-loader

webpack loader to transform css to CSS-IN-JS API.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

CSS-in-JS? Not yet.

Most of libraries just create stylesheets for you. From pure CSS or pure JS code.

NPM

CSS-to-JS

This webpack loader actually converts CSS code into the JavaScript. Not just provide classNames, but wraps everything with client-side CSS-in-JS libraries.

Supported APIs

  • Styled-Components

Example

Given css:

.h1 {
    color: #F00;
}

.P {
    font-size: 14px;
    color: #0F0;
    --css-to-js-component: div;
}

And JS

import { h1, P } from '!css-to-js-loader!./style.css'

// h1 is styled.css
// you can use h1 as mixin
const H1 = styled.div`${h1};`;


// and P is the real styled-component
const App = () => <P>I am Component!</P>   

Thus allows you to write more modular code. And keep all CSS inside CSS.

mixins

.h {
    font-size: 10px;
}

.h1 {
    --css-in-js-mixin: ".h"; /** same as LESS mixins. In css way **/
    color: #F00;
}

Existing CSS libraries.

To manage existing libraries see *-mixins

Licence

MIT

Keywords

FAQs

Package last updated on 20 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc