Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ function css(css, file) {
)
}

if (!options.parser && !options.syntax && !options.stringifier) {
options.syntax = require('postcss-syntax')
}

return postcss(config.plugins)
.process(css, options)
.then(result => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"postcss": "^7.0.0",
"postcss-load-config": "^2.0.0",
"postcss-reporter": "^5.0.0",
"postcss-syntax": "^0.32.0",
"pretty-hrtime": "^1.0.3",
"read-cache": "^1.0.0",
"yargs": "^12.0.1"
Expand Down
16 changes: 16 additions & 0 deletions test/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,19 @@ test('--syntax works', async t => {

t.is(await read(output), await read('test/fixtures/a.sss'))
})

test('automatically switch syntax', async t => {
const dir = tmp()

const { error, stderr } = await cli([
'test/fixtures/b.*',
'-d',
dir,
'--no-map'
])

t.ifError(error, stderr)

t.is(await read(`${dir}/b.sss`), await read('test/fixtures/b.sss'))
t.is(await read(`${dir}/b.css`), await read('test/fixtures/b.css'))
})