LoginSignup
0
1

More than 5 years have passed since last update.

ASP.NETでLessを利用する方法

Last updated at Posted at 2016-11-13

パッケージのインストール

パッケージマネージャーコンソールにて、下記の2つパッケージをインストールする

PM> Install-Package dotLess
PM> Install-Package System.Web.Optimization.Less

ファイルの編集

Shared/_Layout.cshtml ファイルに下記を追加する

Shared/_Layout.cshtml
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - My ASP.NET MVC Application</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/less")  <!-- この行を追加する -->
        @Scripts.Render("~/bundles/modernizr")
    </head>
.
.
.

BundleConfig.cs ファイルに下記を追加する

App_Start/BundleConfig.cs
public class BundleConfig {
    public static void RegisterBundles(BundleCollection bundles) {
      bundles.Add(new LessBundle("~/Content/less").Include("~/Content/*.less")); // この行を追加する
    }
}

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1