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

Option for indentation string #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 4 additions & 1 deletion bin/cssbeautify
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function showUsage() {
console.log();
console.log('Available options:');
console.log();
console.log(' --indent=<val> Indent content with string <val>');
console.log(' -v, --version Shows program version');
console.log();
process.exit(1);
Expand All @@ -56,6 +57,8 @@ process.argv.splice(2).forEach(function (entry) {
console.log('CSS Beautify version 0.3.0');
console.log();
process.exit(0);
} else if (entry.slice(0,9) === '--indent=') {
options.indent = entry.slice(9);
} else if (entry.slice(0, 2) === '--') {
console.log('Error: unknown option ' + entry + '.');
process.exit(1);
Expand All @@ -74,7 +77,7 @@ if (typeof fname !== 'string') {

try {
content = fs.readFileSync(fname, 'utf-8');
style = cssbeautify(content);
style = cssbeautify(content, options);
console.log(style);
} catch (e) {
console.log('Error: ' + e.message);
Expand Down
2 changes: 1 addition & 1 deletion cssbeautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
formatted += ch;
}

formatted = blocks.join('') + formatted;
formatted = blocks.join('') + trimRight(formatted);

return formatted;
}
Expand Down