项目作者: a-la

项目描述 :
CSS Properties For JSX.
高级语言: JavaScript
项目地址: git://github.com/a-la/styles.git
创建时间: 2020-03-17T13:33:22Z
项目社区:https://github.com/a-la/styles

开源协议:GNU Affero General Public License v3.0

下载


@a-la/styles

@a-la/styles">npm version

@a-la/styles is CSS Properties For JSX.


CSS styles JSX autocompletions

  1. yarn add -D @a-la/styles
  2. npm i --save-dev @a-la/styles

Table Of Contents



Usage

By installing this package, you will be able to specify styles on tags and components as JSX properties when using alamode transpiler.

To receive access to auto-completions, you’ll need to import the @a-la/styles package in your source code:

  1. import '@a-la/styles'
  2. // or if using Preact 8:
  3. import '@a-la/styles/preact'
  4. export const Component = () => {
  5. return (<div border="1px solid green">Hello World!</div>)
  6. }

The actual import doesn’t do anything as the source file is blank. It is needed only for VSCode to pick up distributed typings.

Because of a bug in VSCode, you won’t see properties with hyphens, e.g., margin-top and will only see marginTop, but you can actually use both. The camel cases are added for discoverability of properties.



Special Cases

Some CSS properties will interfere with attributes of certain tags. There’s an ignore map at /ignore.json that prevents the output of the following cases:

  1. <hr width color size>
  2. <pre width>
  3. <img width height alt>
  4. <iframe width height>
  5. <embed width height>
  6. <object width height border>
  7. <video width height>
  8. <input width height size alt>
  9. <canvas width height>
  10. <table border>
  11. <body background>
  12. <meta content>
  13. <br clear>
  14. <select size>
  15. <area alt>



GNU Affero General Public License v3.0

Data comes from VS Code Web Custom Data:








Art Deco

© Art Deco™ for À La Mode 2020