I'm using Grunt (grunt-contrib-less) to process my Less files into CSS. This is working, but the sourcemaps are not.
My Less files are in /assets/less
, and Grunt compiles them into /public/css
.
/public/
is my folder that is publicly-viewable on the internet. I imagine there is a way to get sourcemaps to work even when my source Less files are not in the publicly-accessible folder. But I haven't found any examples.
My grunt-contrib-less config is:
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
},
]