0

私は2つのcssファイルを持っています。どちらも右から左の言語のフィックスであり、右から左へのカルチャーが選択されている場合はすべてのページに存在し、そうでない場合は存在しません。レイアウトファイルにbundleconfigに条件付きCSSを追加

現在の定義:

<environment names="Development"> 
    <link rel="stylesheet" href="~/css/site.css" /> 
</environment> 
<environment names="Staging,Production"> 
    <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" /> 
</environment> 

bundleconfig.json:

{ 
    "outputFileName": "wwwroot/css/site.min.css", 
    // An array of relative input file paths. Globbing patterns supported 
    "inputFiles": [ 
     "wwwroot/css/site.css" 
    ] 
    }, 
    { 
    "outputFileName": "wwwroot/js/site.min.js", 
    "inputFiles": [ 
     "wwwroot/js/site.js" 
    ], 
    // Optionally specify minification options 
    "minify": { 
     "enabled": true, 
     "renameLocals": true 
    }, 
    // Optionally generate .map file 
    "sourceMap": false 
    } 

必要なときにバンドルに含める方法はありますか?私は別にそれを含めたくない。

答えて

0

私はこの問題を解決しました。

[ 
    { 
    "outputFileName": "wwwroot/css/site.min.css", 
    // An array of relative input file paths. Globbing patterns supported 
    "inputFiles": [ 
     "wwwroot/css/site.css" 
    ] 
    }, 
    { 
    "outputFileName": "wwwroot/css/sitertl.min.css", 
    // An array of relative input file paths. Globbing patterns supported 
    "inputFiles": [ 
     "wwwroot/css/site.css", 
     "wwwroot/css/rtl.css" 
    ] 
    }, 
    { 
    "outputFileName": "wwwroot/js/site.min.js", 
    "inputFiles": [ 
     "wwwroot/js/site.js" 
    ], 
    // Optionally specify minification options 
    "minify": { 
     "enabled": true, 
     "renameLocals": true 
    }, 
    // Optionally generate .map file 
    "sourceMap": false 
    } 
] 

やレイアウトに私はこのような条件を追加します:bundleconfig.jsonで

私はそれなしで2つの異なる縮小さCSS、RTLパッチと1つずつを作成することを選択し

<environment names="Development"> 
      <link rel="stylesheet" href="~/css/site.css" /> 
      @if (CultureInfo.CurrentUICulture.Name.ToLower() == "fa-ir") 
      { <link href="~/css/rtl.css" rel="stylesheet" />} 
     </environment> 
     <environment names="Staging,Production"> 
@if(CultureInfo.CurrentUICulture.Name.ToLower()=="fa-ir"){ 
      <link rel="stylesheet" href="~/css/sitertl.min.css" asp-append-version="true" />} 
else{ 
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" /> 
} 
     </environment> 
関連する問題