Strip BOM before parsing, fixes #2362 (#2373)

This commit is contained in:
Lucas Azzola authored and Christopher Chedeau committed 2017-07-01 18:11:13 +02:00
1 parent 7cf46acb9d
commit 6f9824778d
5 files changed
+31

No files matched your search

+2
View File
@@ -1,5 +1,6 @@
"use strict";
const stripBom = require("strip-bom");
const comments = require("./src/comments");
const version = require("./package.json").version;
const printAstToDoc = require("./src/printer").printAstToDoc;
@@ -54,6 +55,7 @@ function ensureAllCommentsPrinted(astComments) {
}
function formatWithCursor(text, opts, addAlignmentSize) {
text = stripBom(text);
addAlignmentSize = addAlignmentSize || 0;
const ast = parser.parse(text, opts);
+1
View File
@@ -51,6 +51,7 @@
"rollup-plugin-node-resolve": "2.0.0",
"rollup-plugin-replace": "1.1.1",
"shelljs": "0.7.8",
"strip-bom": "3.0.0",
"sw-toolbox": "3.6.0",
"uglify-es": "3.0.15",
"webpack": "2.6.1"
@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`bom.css 1`] = `

/* Block comment */
html {
content: "#{1}";
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* Block comment */
html {
content: "#{1}";
}
`;
+8
View File
@@ -0,0 +1,8 @@
/* Block comment */
html {
content: "#{1}";
}
+1
View File
@@ -0,0 +1 @@
run_spec(__dirname, { parser: "postcss" });