1tontech / bootstrap4-snippets

Visual studio extension & Intellij plugin for Bootstrap 4, Font awesome 4, Font Awesome 5 Free & Pro snippets/live templates
MIT License
118 stars 43 forks source link

Indent Bootstrap 4 snippets #8

Open hunkjazz opened 5 years ago

hunkjazz commented 5 years ago

I love the extension for VSCode, though I gotta say I lose quite some time indenting generated code.

As Bootstrap tend to require lots of classes and others attributes, the code becomes a mess, easily. That's why I want to ask for your permission so I can PR a set of indented snippets.

Things like b4-navbar-background:

<nav class="navbar navbar-expand-sm navbar-dark bg-primary">
    <a class="navbar-brand" href="#">Navbar</a>
    <button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId" aria-controls="collapsibleNavId"
        aria-expanded="false" aria-label="Toggle navigation"></button>
    <div class="collapse navbar-collapse" id="collapsibleNavId">
        <ul class="navbar-nav mr-auto mt-2 mt-lg-0">
            <li class="nav-item active">
                <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Link</a>
            </li>
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="dropdownId" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
                <div class="dropdown-menu" aria-labelledby="dropdownId">
                    <a class="dropdown-item" href="#">Action 1</a>
                    <a class="dropdown-item" href="#">Action 2</a>
                </div>
            </li>
        </ul>
        <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="text" placeholder="Search">
            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
        </form>
    </div>
</nav>

Would become redable snippets like that:

<nav class="navbar navbar-expand-sm navbar-dark bg-primary">
    <a class="navbar-brand" href="#">Navbar</a>

    <button class="navbar-toggler d-lg-none" 
            type="button" 
            data-toggle="collapse" 
            data-target="#collapsibleNavId" 
            aria-controls="collapsibleNavId"
            aria-expanded="false" 
            aria-label="Toggle navigation"></button>

    <div class="collapse navbar-collapse" id="collapsibleNavId">
        <ul class="navbar-nav mr-auto mt-2 mt-lg-0">

            <li class="nav-item active">
                <a class="nav-link" href="#">
                  Home <span class="sr-only">(current)</span>
                </a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="#">Link</a>
            </li>

            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" 
                    href="#" 
                    id="dropdownId" 
                    data-toggle="dropdown" 
                    aria-haspopup="true" 
                    aria-expanded="false">Dropdown</a>

                <div class="dropdown-menu" aria-labelledby="dropdownId">
                    <a class="dropdown-item" href="#">Action 1</a>

                    <a class="dropdown-item" href="#">Action 2</a>
                </div>
            </li>
        </ul>

        <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="text" placeholder="Search">

            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
        </form>
    </div>
</nav>
thekalinga commented 5 years ago

@JLammeer Sure, Thanks for the offer

Usually, people have their own shortcut to format the files. Some like spaces, some like tabs, some like your formatting, some like the current formatting

I dont have any preference. Please go ahead and update the files if you think that formatting can help others aswell