diff --git a/build/style-compiler/NodeRunner.cs b/build/style-compiler/NodeRunner.cs index c2b656cbe95f..c28db1813ac9 100644 --- a/build/style-compiler/NodeRunner.cs +++ b/build/style-compiler/NodeRunner.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics; using System.IO; +using Newtonsoft.Json; namespace StyleCompiler { @@ -11,7 +12,13 @@ static class NodeRunner public static string CompileLess(string less) { - return RunExternalApp(ResolveNodeToolPath("node"), "node_modules/less/bin/lessc -", Utils.GetRepoRootPath(), less); + return RunExternalApp(ResolveNodeToolPath("node"), $"node_modules/less/bin/lessc --autoprefix=\"{ReadBrowsersList()}\" -", Utils.GetRepoRootPath(), less); + } + + static string ReadBrowsersList() + { + dynamic manifest = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(Utils.GetRepoRootPath(), "package.json"))); + return string.Join(",", manifest["browserslist"]); } static string RunExternalApp(string path, string arguments, string workingDirectory, string stdIn) diff --git a/package.json b/package.json index ce23ae6aaf22..8e316950b1fb 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "knockout": "^3.4.2", "lazypipe": "^1.0.1", "less": "^2.7.1", + "less-plugin-autoprefix": "^2.0.0", "lint-staged": "^3.4.0", "merge-stream": "^1.0.0", "mustache": "2.3.0", @@ -104,5 +105,11 @@ "dev": "gulp dev", "test-env": "node testing/launch" }, + "browserslist": [ + "last 2 versions", + "ios > 8", + "ie > 10", + "> 1%" + ], "pre-commit": "lint-staged" }