diff --git a/.gitignore b/.gitignore index 93f1361..4d2f777 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules npm-debug.log +.nyc_output/ +coverage/ diff --git a/README.md b/README.md index 3b56dc4..d59735c 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,7 @@ $ cat input.css | stylefmt --stdin-filename input.css ```js var fs = require('fs'); var postcss = require('postcss'); -var scss = require('postcss-scss'); // when you use scss syntax +var syntax = require('postcss-html'); // when you use non-standard syntax var stylefmt = require('stylefmt'); var css = fs.readFileSync('input.css', 'utf-8'); @@ -311,7 +311,7 @@ postcss([ stylefmt ]).process(css, { from: 'input.css', - syntax: scss + syntax: syntax }) .then(function (result) { result.css; // formatted code diff --git a/bin/cli.js b/bin/cli.js index 1d34715..bfaf719 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -24,7 +24,7 @@ var argv = minimist(process.argv.slice(2), { }) var postcss = require('postcss') -var scss = require('postcss-scss') +var syntax = require('postcss-html') if (argv.v) { console.log(pkg.version) @@ -76,7 +76,7 @@ if (argv.r) { postcss([stylefmt(options)]) .process(css, { from: fullPath, - syntax: scss + syntax: syntax }) .then(function (result) { var formatted = result.css @@ -98,7 +98,7 @@ if (argv.r) { postcss([stylefmt(options)]) .process(css, { from: options.codeFilename, - syntax: scss + syntax: syntax }) .then(function (result) { process.stdout.write(result.css) @@ -122,7 +122,7 @@ function processMultipleFiles (files) { return postcss([stylefmt(options)]) .process(css, { from: fullPath, - syntax: scss + syntax: syntax }) .then(function (result) { var formatted = result.css @@ -156,7 +156,7 @@ function processMultipleFiles (files) { function isCss (filePath) { - return /^\.css|\.less|\.pcss|\.scss|\.wxss$/i.test(path.extname(filePath)) + return /^\.(?:vue|html?|(?:(?:[ps]?c)|le|wx|sa?)ss)$/i.test(path.extname(filePath)) } diff --git a/package.json b/package.json index 3888b31..245c197 100644 --- a/package.json +++ b/package.json @@ -37,12 +37,16 @@ "globby": "^6.1.0", "minimist": "^1.2.0", "postcss": "^6.0.1", + "postcss-html": "^0.4.0", + "postcss-less": "^1.0.1", + "postcss-sass": "^0.1.0", "postcss-scss": "^1.0.0", "postcss-sorting": "^2.1.0", "postcss-value-parser": "^3.3.0", "stdin": "^0.0.1", "stylelint": "^7.10.1", - "stylelint-order": "^0.4.4" + "stylelint-order": "^0.4.4", + "sugarss": "^1.0.0" }, "devDependencies": { "each-series": "^1.0.0",