postcss-jsx
PostCSS syntax for parsing CSS in JS literals
Last updated 5 years ago by ai .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install postcss-jsx 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.36.4                                ...           latest (5 years ago)

25 Versions

  • 0.36.4                                ...           5 years ago
  • 0.36.3                                ...           5 years ago
  • 0.36.2                                ...           5 years ago
  • 0.36.1                                ...           6 years ago
  • 0.36.0                                ...           6 years ago
  • 0.35.0                                ...           6 years ago
  • 0.34.0                                ...           6 years ago
  • 0.33.0                                ...           6 years ago
  • 0.32.0                                ...           6 years ago
  • 0.31.0                                ...           6 years ago
  • 0.30.0                                ...           6 years ago
  • 0.28.0                                ...           7 years ago
  • 0.27.0                                ...           7 years ago
  • 0.25.0                                ...           7 years ago
  • 0.26.0                                ...           7 years ago
  • 0.24.0                                ...           7 years ago
  • 0.10.0                                ...           7 years ago
  • 0.9.0                                ...           7 years ago
  • 0.8.0                                ...           7 years ago
  • 0.7.0                                ...           7 years ago
  • 0.6.0                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.5.0                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.1-beta.1                                ...           7 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 14
Last Day 0
Last Week 14
Last Month 0
Dependencies (1)
Dev Dependencies (10)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |