Beispiel #1
0
 /// <summary>
 /// Constructs a instance of CSS autoprefixer
 /// </summary>
 /// <param name="createJsEngineInstance">Delegate that creates an instance of JS engine</param>
 /// <param name="virtualFileSystemWrapper">Virtual file system wrapper</param>
 /// <param name="options">Autoprefixing options</param>
 public CssAutoprefixer(Func <IJsEngine> createJsEngineInstance,
                        IVirtualFileSystemWrapper virtualFileSystemWrapper,
                        AutoprefixingOptions options)
 {
     _jsEngine = createJsEngineInstance();
     _virtualFileSystemWrapper = virtualFileSystemWrapper;
     _options       = options ?? new AutoprefixingOptions();
     _optionsString = ConvertAutoprefixingOptionsToJson(_options).ToString();
 }
Beispiel #2
0
        /// <summary>
        /// Converts a autoprefixing options to JSON
        /// </summary>
        /// <param name="options">Autoprefixing options</param>
        /// <returns>Autoprefixing options in JSON format</returns>
        private JObject ConvertAutoprefixingOptionsToJson(AutoprefixingOptions options)
        {
            var optionsJson = new JObject(
                new JProperty("browsers", new JArray(options.Browsers)),
                new JProperty("cascade", options.Cascade),
                new JProperty("add", options.Add),
                new JProperty("remove", options.Remove),
                new JProperty("supports", options.Supports),
                new JProperty("flexbox", options.Flexbox),
                new JProperty("grid", options.Grid),
                new JProperty("stats", GetCustomStatisticsFromFile(options.Stats))
                );

            return(optionsJson);
        }