styled-jsx-plugin-postcss
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,2 +5,6 @@ const loopWhile = require('deasync').loopWhile | ||
module.exports = (css, settings) => { | ||
const cssWithPlaceholders = css | ||
.replace(/%%styled-jsx-placeholder-(\d+)%%/g, (_, id) => | ||
`/*%%styled-jsx-placeholder-${id}%%*/` | ||
) | ||
let processedCss | ||
@@ -14,3 +18,3 @@ let wait = true | ||
processor(css) | ||
processor(cssWithPlaceholders) | ||
.then(resolved) | ||
@@ -25,2 +29,5 @@ .catch(resolved) | ||
return processedCss | ||
.replace(/\/\*%%styled-jsx-placeholder-(\d+)%%\*\//g, (_, id) => | ||
`%%styled-jsx-placeholder-${id}%%` | ||
) | ||
} |
{ | ||
"name": "styled-jsx-plugin-postcss", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Plugin to add PostCSS support to styled-jsx", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,6 +12,6 @@ const assert = require('assert') | ||
it('works with expressions placeholders', () => { | ||
it('works with placeholders', () => { | ||
assert.equal( | ||
plugin('p { img { display: block } color: %%styled-jsx-expression-1%%; }'), | ||
'p { color: %%styled-jsx-expression-1%%; } p img { display: block }' | ||
plugin('p { img { display: block } color: %%styled-jsx-placeholder-0%%; } %%styled-jsx-placeholder-1%%'), | ||
'p { color: %%styled-jsx-placeholder-0%%; } p img { display: block } %%styled-jsx-placeholder-1%%' | ||
) | ||
@@ -18,0 +18,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33748
73