console.log('%cI am a big fat red log record', 'color: red; background-color: yellow; font-size: x-large') — css formatted console logs, note the '%c' before the logged value
//# sourceURL= 'whatever.js' — let the devtools (at least Chrome) know the name of a dynamically loaded script (loaded for example by jquery's $.load(path)). This allows direct modification of such script inside devtool's 'sources' tab (for the current browser instance - not physical file, of course). Without this the script will be referenced as 'WM#####' and non-modifiable. Note this marker must be inserted on the last row of the script and the script must not be minified (it can, but then you have to do edits on the minified single row. As soon as you use the 'prettify' feature of the devtools it will become unmodifiable again). Then you can save your changes by Ctrl+S without need to reload the page. This actually saves me huge amount of time per day as I am a maintainer of SPApp and each such rebuild&reload takes quite a while
1
u/davi86d Mar 19 '19
A bit more of debugging:
console.log('%cI am a big fat red log record', 'color: red; background-color: yellow; font-size: x-large') — css formatted console logs, note the '%c' before the logged value
//# sourceURL= 'whatever.js' — let the devtools (at least Chrome) know the name of a dynamically loaded script (loaded for example by jquery's $.load(path)). This allows direct modification of such script inside devtool's 'sources' tab (for the current browser instance - not physical file, of course). Without this the script will be referenced as 'WM#####' and non-modifiable. Note this marker must be inserted on the last row of the script and the script must not be minified (it can, but then you have to do edits on the minified single row. As soon as you use the 'prettify' feature of the devtools it will become unmodifiable again). Then you can save your changes by Ctrl+S without need to reload the page. This actually saves me huge amount of time per day as I am a maintainer of SPApp and each such rebuild&reload takes quite a while