Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the function of jss's high-performance JS to CSS compiler

Shulou Source: shulou.com Published: 2022-06-02 15:43:05 10月25日 Update

This article focuses on "what is the role of jss's high-performance JS to CSS compiler", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the role of jss's high-performance JS to CSS compiler?"

JsS is a more powerful abstraction than css, which uses JavaScript to describe styles in a declarative and maintainable manner. It is a high-performance jstocss compiler that runs at run time and on the server side. It is low-level and framework-independent, about the size of 6KB, and can be extended through the plug-in API.

JsS usage scenario

Build heavy applications for JavaScript

Using a component-based architecture

Building reusable UI libraries

Requires a conflict-free css (external content, third-party UI components, etc.)

Need to share code between js and css

It's important to have a small download.

Robustness and code reuse are important

Easy maintenance is important

The code for jsS

Demo

Importjssfrom'jss'

Importpresetfrom'jss-preset-default'

Importcolorfrom'color'

/ / Onetimesetupwithdefaultpluginsandsettings.

Jss.setup (preset ())

Conststyles= {

Button: {

FontSize:12

'&: hover': {

Background:'blue'

}

}

CtaButton: {

Extend:'button'

'&: hover': {

Background:color ('blue')

.darken (0.3)

.hex ()

}

}

Button: {

Width:200

}

}

}

Const {classes} = jss.createStyleSheet (styles) .attach ()

Document.body.innerhtml= `

Button

CTAButton

At this point, I believe that everyone on the "jss high-performance JS to CSS compiler what the role of" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Compiler high performance compilation function important code content components learning running robust practical powerful deeper between interest can be passed available in scene size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Information Docker MySQL NVidia