Log In

Blog

Collapsing Code Blocks on Load

posted October 19, 2018, by Klaus

Simpl.js lets you collapse code blocks and arrays when your code is first loaded into the editor. This can be extremely useful for getting an overview of the features and "shape" of the code, both for yourself and for others reading it.

To use it, simply add a //- to the end of the line with the opening { or [:

expandedcollapsed

The benefits of automatic code folding, used in the right places, can be dramatic, as seen below in a sample blog application. Users working on or browsing this application's code can easily identify the endpoint code block they're interested in and drill down from there.

overview