2
votes

I have read through numerous similar resources here but they eiter use bower which is apparently outdated or webpack which I am not going to learn now as the projects i'm working on use gulp. I have my file structure as follow:

      - Project
        - /src
           - /scss
           - /js
           - /img
           - .index.html
        - /dist
        - /node_modules
           - /bootstrap
             -/dist
               - /css
               - /js
        - .package.json
        - .gulfile.js
  1. How do I get to work with both the bootstrap css and the js from the node_modules folder in my src/ index.html file.(obviously at the end I would like to still just use<script src="js/bootstrap.js"><?script> or better compiled <script src="js/main.js"><?script>)
  2. How do i then compile it to the dist folder with both bootstrap components still available for production.

Hope this makes sense

1

1 Answers

-1
votes

Since it looks like you are using scss, you can simply import the main Bootstrap file into yours

should be something like

@import '../../node_modules/bootstrap/dist/css/bootstrap';

For the JS part of Bootstrap, you could simply write a gulp task that concatenates your script and the Bootstrap one together. You can easily achieve this using packages like gulp-concat!