Skip to content

Commit

Permalink
Add CSS AutoPrefixer (#5148)
Browse files Browse the repository at this point in the history
* Added CSS autoprefixer as 'less-plugin-autoprefix'

* Change supported iOS versions to 9+
  • Loading branch information
AntonSermyazhko committed Aug 27, 2018
1 parent e2bd665 commit a9f0036
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build/style-compiler/NodeRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using Newtonsoft.Json;

namespace StyleCompiler
{
Expand All @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}

0 comments on commit a9f0036

Please sign in to comment.