Custom theme name differences with roots name


in the starter guide you say, download roots, rename and grunt.

If I rename roots to mytheme, is mytheme string supposed to be found anywhere else in the code? I have the exact same content in the files that if I wouldnt renamed it and I would like to be sure.

On this purpose, should I modify something in Gruntfile.js such as

sourceMappingURL: '/app/themes/roots/assets/js/' sourceMapRootpath: '/app/themes/roots/'

to app/themes/mytheme


That’s correct. You should be changing the Gruntfile to match the new name/path your theme has.

edit: I think that’s actually the only other place you need to change it.

this might explain why my grunt doesnt work properly - how do you go about changing it?

You just edit your Gruntfile.js and change roots in the path to whatever your theme name is.

fathomed it thank you @swalkinshaw - sadly grunt watch still wont run - i have to manually type it every time - pain!!!

What errors does running grunt watch produce?

The watch task has to be running before it can be triggered by any file changes; so if you make changes, then run watch, it will do nothing.

You can use grunt && grunt watch to recompile and start the watch task.

@Foxaii - its all installed in the correct path etc. - if i type in grunt watch it starts ‘watching’ - the minute i make any changes to my Less files, it just says there was a error, -

Waiting…Bus error: 10

I fixed it using this blog post Fixing Bus Error 10

So just to be sure, in my scripts.min.js now I have this at the end

//# sourceMappingURL=/app/themes/cdb/assets/js/

But the urs is actually
is that correct?


No. You need to use the correct file path for your server.
The examples given were based on a Bedrock install.

but they are relatives right?, so in gruntfile is this correct???

options: {
  sourceMap: 'assets/js/',

  **sourceMappingURL: '/wp-content/themes/cdb/assets/js/'**


Yes. That should be fine.

It’s also far easier to debug this in browser rather than go back and forth on discourse. You’ll be able see if it’s a 404 and why.

The time to post would be if the sourcemaps are not working and the file is being loaded correctly.

In this case, my theme is loading fine with the “wrong” sourcemap path and there is no 404 in chrome developer tools.

Just this //# sourceMappingURL=/app/themes/cdb/assets/js/ as I said in my previous post at the end of scripts.min.js so I don’t really know at which point “roots” is using that .map file.

Thanks for your time

Sourcemaps are dev tools, so the theme will load fine without it.

When sourcemaps are enabled, dev tools will reference specific the .less file or script instead of main.min.css/scripts.min.js file that is was minified and concatenated into.

The Gruntfile needs to be edited to add support for sourcemaps but you can read more about that here or try the search.

thanks, I am checking it