Bootstrap Studio + Sass + Gulp + BrowserSync

Submitted by kentr on Wed, 08/30/2017 - 17:26

Problem

Bootstrap Studio doesn't currently support Sass.

Solution

With some creative workarounds, it's possible to get most of the benefits of Bootstrap Studio integrated combined with a Gulp + Sass + BrowserSync workflow.

Setup

File structure

  1. Create a directory to hold the web-ready files (aka, an "app" directory).
  2. Put sass source files in source/sass.

Gulp Sass / BrowserSync

Set up a standard gulp Sass workflow:

  • src: source/sass/**/*.scss
  • dest: app/assets/css

Use these BrowserSync options:

{
    server: app,
    files: ["app/*.html", "app/**/*.js"]
}

​​​​​​Bootstrap Studio

  1. Name the page index.html
  2. Configure the export settings to export to the app directory.
  3. Link external stylesheet http://localhost:3000/assets/css/styles.css.
    This pulls in the css file(s) that will be served by gulp.
  4. Link external JavaScript http://localhost:3000/assets/js/whatever.js.
    This pulls in the js file(s) that will be served by gulp.

Workflow

  1. Run gulp serve as usual, using this server as the "preview" instead of the Bootstrap Studio preview.
  2. Make css edits in an external editor.  If gulp is set up correctly, they will be recompiled automatically and injected into the preview via BrowserSync as usual.
  3. Make HTML edits in Bootstrap Studio and export them to see the result in the BrowserSync server.  If BrowserSync is set up correctly, the exports will change the files in the app directory and trigger a reload.