aboutsummaryrefslogtreecommitdiff
path: root/node_modules/clean-css/lib/options
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/clean-css/lib/options
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/clean-css/lib/options')
-rw-r--r--node_modules/clean-css/lib/options/format.js33
1 files changed, 32 insertions, 1 deletions
diff --git a/node_modules/clean-css/lib/options/format.js b/node_modules/clean-css/lib/options/format.js
index afcf5c967..48c7efa8e 100644
--- a/node_modules/clean-css/lib/options/format.js
+++ b/node_modules/clean-css/lib/options/format.js
@@ -1,3 +1,5 @@
+var systemLineBreak = require('os').EOL;
+
var override = require('../utils/override');
var Breaks = {
@@ -12,6 +14,12 @@ var Breaks = {
BetweenSelectors: 'betweenSelectors'
};
+var BreakWith = {
+ CarriageReturnLineFeed: '\r\n',
+ LineFeed: '\n',
+ System: systemLineBreak
+};
+
var IndentWith = {
Space: ' ',
Tab: '\t'
@@ -25,10 +33,12 @@ var Spaces = {
var DEFAULTS = {
breaks: breaks(false),
+ breakWith: BreakWith.System,
indentBy: 0,
indentWith: IndentWith.Space,
spaces: spaces(false),
- wrapAt: false
+ wrapAt: false,
+ semicolonAfterLastProperty: false
};
var BEAUTIFY_ALIAS = 'beautify';
@@ -75,6 +85,10 @@ function formatFrom(source) {
return false;
}
+ if (typeof source == 'object' && 'breakWith' in source) {
+ source = override(source, { breakWith: mapBreakWith(source.breakWith) });
+ }
+
if (typeof source == 'object' && 'indentBy' in source) {
source = override(source, { indentBy: parseInt(source.indentBy) });
}
@@ -133,6 +147,8 @@ function toHash(string) {
accumulator[name] = parseInt(value);
} else if (name == 'indentWith') {
accumulator[name] = mapIndentWith(value);
+ } else if (name == 'breakWith') {
+ accumulator[name] = mapBreakWith(value);
}
return accumulator;
@@ -167,6 +183,21 @@ function normalizeValue(value) {
}
}
+function mapBreakWith(value) {
+ switch (value) {
+ case 'windows':
+ case 'crlf':
+ case BreakWith.CarriageReturnLineFeed:
+ return BreakWith.CarriageReturnLineFeed;
+ case 'unix':
+ case 'lf':
+ case BreakWith.LineFeed:
+ return BreakWith.LineFeed;
+ default:
+ return systemLineBreak;
+ }
+}
+
function mapIndentWith(value) {
switch (value) {
case 'space':