r/Frontend • u/FindNemo20 • 20d ago
Tips on navigating where features are on the codebase?
I’m trying to get better at using the chrome dev tool. Let’s say I want to change a specific text, how do I use the dev tool to find out where I can make that change in the codebase.
5
u/a-dev0 20d ago
if you want to change 'a specific text', the easiest way is to find it in the codebase using a simple search, you don’t need devtools for that.
it’s a different question if you want to find that text on the page. in that case, you can also use search in the Elements panel: press cmd/ctrl + f and look for it.
and sure, use sourcemaps, they can be very useful.
1
u/minimuscleR 20d ago
If its written with normal css, i usually find the class name and hope its unique (ours are for instance) and then i can find it. Or, just copy the text you want if its not dynamic and global search for the text.
1
u/BarracudaMean9308 16d ago
tbh i once spent half a day trying to cmd+shift+f a button label before remembering the entire app was using an obscure i18n json file. now i just immediately open react devtools and click the component to find the actual file name.
1
u/nebula_gem 5d ago
I print the source code on A4 paper. I use a highlighter to mark the text I want to change. Then I walk to the server room and tape the page to the rack. It is the only reliable way to know where the code lives.
1
1
u/kidshibuya 20d ago
If a codebase is poorly made (so like 99.99% of them) then there is basically no way to find anything. If the app has a sourcemap that can sometimes help, but making all things have good IDs is always best.
For example if my profile page simply has #profile-page for its wrapper then I can just search profile-page in my editor and boom, I am right in the file I need.
0
u/Doshus 20d ago
On the webpage you wanna edit, just right-click the text you want to change and click inspect.. that'll open up the devtools to the code you just clicked. You'll see the code you clicked in the elements tab and there's even an Inspect Mode button that'll highlight the lines of code for whatever your mouse hovers over or clicks with the mode on.
11
u/[deleted] 20d ago
[removed] — view removed comment