Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync problem #35

Merged
merged 4 commits into from
Sep 6, 2020
Merged

Fix sync problem #35

merged 4 commits into from
Sep 6, 2020

Conversation

tldrd0117
Copy link
Contributor

I used execSync

index.js Outdated Show resolved Hide resolved
@@ -15,7 +15,8 @@ describe('styled-jsx-plugin-postcss', () => {

it('works with placeholders', () => {
assert.equal(
plugin('p { color: %%styled-jsx-placeholder-0%%; & img { display: block; } } %%styled-jsx-placeholder-1%%'), 'p { color: %%styled-jsx-placeholder-0%% } p img { display: block; } %%styled-jsx-placeholder-1%%'
plugin('p { color: %%styled-jsx-placeholder-0%%; & img { display: block; } } %%styled-jsx-placeholder-1%%')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a test where the css has quotes and other characters that could be problematic when stringifying to JSON

index.js Outdated
settingsArg = JSON.stringify(settings).replace(/\"/g,`\\"`)
const result = childProcess.execSync(`node ${__dirname}/processor.js "${cssWithPlaceholdersArg}" "${settingsArg}"`,
{ encoding: 'utf8', maxBuffer: 50 * 1024 * 1024 })
const result = execSync(`node ${path.resolve(__dirname, "processor.js")}`, {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit you can use

spawnSync(path.resolve(__dirname, "processor.js"), options)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i commited

@giuseppeg giuseppeg merged commit 52a30d9 into giuseppeg:master Sep 6, 2020
@giuseppeg giuseppeg mentioned this pull request Sep 6, 2020
@giuseppeg
Copy link
Owner

@tldrd0117 awesome thank you a lot for this contribution! I released this changes as 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants