postcss-jsx

WebJar for postcss-jsx

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

postcss-jsx
Last Version

Last Version

0.35.0
Release Date

Release Date

Type

Type

jar
Description

Description

postcss-jsx
WebJar for postcss-jsx
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/gucong3000/postcss-jsx

Download postcss-jsx

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/postcss-jsx/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>postcss-jsx</artifactId>
    <version>0.35.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/postcss-jsx/
implementation 'org.webjars.npm:postcss-jsx:0.35.0'
// https://jarcasting.com/artifacts/org.webjars.npm/postcss-jsx/
implementation ("org.webjars.npm:postcss-jsx:0.35.0")
'org.webjars.npm:postcss-jsx:jar:0.35.0'
<dependency org="org.webjars.npm" name="postcss-jsx" rev="0.35.0">
  <artifact name="postcss-jsx" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='postcss-jsx', version='0.35.0')
)
libraryDependencies += "org.webjars.npm" % "postcss-jsx" % "0.35.0"
[org.webjars.npm/postcss-jsx "0.35.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : babel__core jar [7.1.2,8)
org.webjars.npm : postcss-styled Optional jar [0.34.0,)

Project Modules

There are no modules declared in this project.

PostCSS JSX Syntax

NPM version Travis Travis Codecov David

PostCSS syntax for parsing CSS in JS literals:

Getting Started

First thing's first, install the module:

npm install postcss-syntax postcss-jsx --save-dev

Use Cases

const postcss = require('postcss');
const stylelint = require('stylelint');
const syntax = require('postcss-syntax');
postcss([stylelint({ fix: true })]).process(source, { syntax: syntax }).then(function (result) {
	// An alias for the result.css property. Use it with syntaxes that generate non-CSS output.
	result.content
});

input:

import glm from 'glamorous';
const Component1 = glm.a({
	flexDirectionn: 'row',
	display: 'inline-block',
	color: '#fff',
});

output:

import glm from 'glamorous';
const Component1 = glm.a({
	color: '#fff',
	display: 'inline-block',
	flexDirectionn: 'row',
});

Advanced Use Cases

Add support for more css-in-js package:

const syntax = require('postcss-syntax')({
	"i-css": (index, namespace) => namespace[index + 1] === "addStyles",
	"styled-components": true,
});

See: postcss-syntax

Style Transformations

The main use case of this plugin is to apply PostCSS transformations to CSS code in template literals & styles as object literals.

Versions

Version
0.35.0