Sourcemap only references main.css (no .less files)`

I’m having troubles with the less sourcemaps in the latest version of Roots (not using Composer):

My gruntfile contains:

sourceMap: true,
sourceMapFilename: 'assets/css/',
sourceMapRootpath: '/wp-content/themes/roots-master/'


  • main.css & are correctly generated upon grunt dev, both are in assets/css/
  • main.css contains reference to /*# */
  • doesn’t contain a single reference to my less files, there’s only a reference to main.css: {"version":3,"sources":["main.css"],"names":[],

I’m working on local vhost on XAMPP, used to work fine in previous projects / previous versions of Roots.

I don’t have a clue what might be wrong - so far I only made a couple of changes in the .less files (which compile without problems).

Any ideas?

If it used to work before then what’s different about this project? Have you added any new Grunt packages?

Are you sure that your sourceMapRootpath is entered correctly?

Any other anomalous behavior throughout your workflow?

Have you tried deleting node_modules/ and re-installing?

Previous projects were built on Roots v 6.x.x, current one is Roots 7.0.1 - which contains the new autoprefixer package, among others.

I managed to fix it by removing autoprefixer from the watch command: tasks: ['less:dev', 'autoprefixer:dev'] became tasks: ['less:dev'] - I guess the problem is situated in the map option of autoprefixer.

Thanks for pointing me in the right direction…

It’s most likely still something in your setup because autoprefixer works just fine for me and my CSS maps display full LESS paths but I’m glad you worked out something for now.

@ptriek you might double-check that in your Gruntfile.js, the autoprefixer:dev:options:map is written like this:

map: {
  prev: 'assets/css/'

and not like this:

map: 'assets/css/'

If you had the latter, this change may fix the problem, allowing you to put autoprefixer back in the watch command and have your sourcemaps work. See Roots #1082.

@fullyint That worked like a charm, wonderful, thanks!