Less ファイルを CSS に処理するために Grunt (grunt-contrib-less) を使用しています。これは機能していますが、ソースマップは機能していません。
私の Less ファイルは に/assets/lessあり、Grunt はそれらを にコンパイルします/public/css。
/public/は、インターネット上で公開されている私のフォルダーです。私のソースLessファイルが公的にアクセス可能なフォルダーにない場合でも、ソースマップを機能させる方法があると思います。しかし、私は例を見つけていません。
私のうなり声のない構成は次のとおりです。
options: {
compress: true,
yuicompress: true,
optimization: 2,
sourceMap: true,
sourceMapFilename: "public/css/main.css.map", //Write the source map to a separate file with the given filename.
sourceMapBasepath: "../assets/less", //Sets the base path for the Less file paths in the source map.
sourceMapRootpath: "/",//Adds this path onto the Less file paths in the source map.
},
files: [
{
expand: true, // Enable dynamic expansion.
cwd: 'assets/less/', // Src matches are relative to this path.
src: ['*.less'], // Actual pattern(s) to match.
dest: 'public/css/', // Destination path prefix.
ext: '.css', // Dest filepaths will have this extension.
extDot: 'first' // Extensions in filenames begin after the first dot
},
]