Search code examples
twitter-bootstrapmarkolasso.js

How do I include bootstrap js in a marko app using lasso?


I'd like to include the Bootstrap JS in my Marko app using Lasso. How should I go about doing that?


Solution

  • First, install the required packages with npm:

    npm install --save bootstrap jquery popper.js
    

    Then, create a browser.json file in the same directory as the component that has the <lasso-page /> tag. Add the appropriate paths under dependencies. With my component in project-base/views/components/Layout/, my browser.json looks like

    {
      "dependencies": [
        "popper.js/dist/umd/popper.min.js",
        "jquery/dist/jquery.slim.min.js",
        "bootstrap/dist/js/bootstrap.min.js"
      ]
    }
    

    Finally, reference browser.json from your <lasso-page /> tag:

    <lasso-page package-path="./browser.json" />