예제 #1
0
        /// <summary>
        /// Searches for font assets at a given location and returns a quantity of found assets
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        private static IEnumerable <Uri> GetFontAssetsByLocation(Uri location)
        {
            var availableAssets = s_assetLoader.GetAssets(location);

            var matchingAssets = availableAssets.Where(x => x.absolutePath.EndsWith(".ttf") || x.absolutePath.EndsWith(".otf"));

            return(matchingAssets.Select(x => GetAssetUri(x.absolutePath, x.assembly)));
        }
        /// <summary>
        /// Searches for font assets at a given location and returns a quantity of found assets
        /// </summary>
        /// <param name="fontFamilyKey"></param>
        /// <returns></returns>
        private static IEnumerable <Uri> GetFontAssetsBySource(FontFamilyKey fontFamilyKey)
        {
            var availableAssets = s_assetLoader.GetAssets(fontFamilyKey.Source, fontFamilyKey.BaseUri);

            var matchingAssets =
                availableAssets.Where(x => x.AbsolutePath.EndsWith(".ttf") || x.AbsolutePath.EndsWith(".otf"));

            return(matchingAssets);
        }
예제 #3
0
        static string ProcessJs(string options, IAssetLoader assetLoader, string path)
        {
            var opts = options.Split(':');

            var assets = assetLoader.GetAssets(path, AreaJavascriptHandler.FileMatch);

            if (!assets.Any())
            {
                return(null);
            }

            string result;

            IJavascriptPreprocessor javascriptPreprocessor;

            if (opts[0] == "babel")
            {
                javascriptPreprocessor = new BabelJavascriptPreprocessor(opts.Contains("sourcemaps"));
                result = javascriptPreprocessor.Process(assets);

                if (opts.Contains("minify"))
                {
                    javascriptPreprocessor = new YuiJavascriptPreprocessor();
                    result = javascriptPreprocessor.Process(new [] { new AssetContent("<babel-output>", result) });
                }
            }
            else
            {
                javascriptPreprocessor = new YuiJavascriptPreprocessor();
                result = javascriptPreprocessor.Process(assets);
            }

            return(result);
        }