SPFx: Cut the clutter

SharePoint Framework (SPFx) is new, lots to learn, explore and build new innovative modern features into SharePoint Modern Interfaces. With SPFX, you will notice you get a lot of extra files for configuration, libraries, temp code and compiled code; a lot of clutter and noise that’s not needed as part of the majority of development, it just gets in the way when I want to focus on the code! Huff….

SPFX Files
Lots of extra files, do we really need to see them?

The above example isn’t a large project but you can see lot more files that is necessary to SEE they are necessary for compilation, debugging etc. But really do we need to see these files?

The great thing in Visual Studio, the solution explorer was just easy to read, only showing the projects, code; no build files and minimal config files, neat and tidy.

Blissful world of Visual Studio

So lets sort this out.

Let’s simplify

Its actually very simple to cut the clutter. Visual Studio Code is an awesome tool and very easy to customise. It turns out that you can achieve this happy simply life with a few lines of JSON to the user settings file.

Cut the clutter.gif
Cutting the clutter in Visual Studio Code

You can edit the editor to exclude (hide) files from view, open your File > Preferences > User Settings (CTRL + ,) and paste in the code below:

“files.exclude”: {
“**/.git”: true,
“**/.svn”: true,
“**/.hg”: true,
“**/CVS”: true,
“**/.DS_Store”: true,

//Exclude these spfx locations
“**/.vscode”: true,
“**/node_modules”: true,
“**/lib”: true,
“**/temp”: true,

//Optional exclusions
“**/gulpfile.js”: true,
“**/package.json”: true,
“**/.gitignore”: true

GitHub Gist

SPFX Files - Tidy
Bliss restored

There, hiding configuration files, that you rarely need just takes away the clutter and gives you a view that you can focus on YOUR code and distribution files. You can easily change these to suit your needs but adding lines and disabling settings (change true to false) to get those files back into the viewer.