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

Add CSS AutoPrefixer #5148

Merged
merged 2 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 > 7",
Copy link
Contributor

@DokaRus DokaRus Aug 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ios > 8? 8.x => ~0.45%
https://data.apteligent.com/ios/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen the separate file browserslist in some projects. Is it possible to extract such file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for me, not a problem to increase the version of iOS to 9+.
Think that a separate file will be superfluous.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nightskylark
package.json is easier to read.
.browserslistrc has comments, etc, and it's not supported automatically by the plugin

"ie > 10",
"> 1%"
],
"pre-commit": "lint-staged"
}