Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
npm-debug.log
.nyc_output/
coverage/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -311,7 +311,7 @@ postcss([
stylefmt
]).process(css, {
from: 'input.css',
syntax: scss
syntax: syntax
})
.then(function (result) {
result.css; // formatted code
Expand Down
10 changes: 5 additions & 5 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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))
}


Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down