2

I have SailsJs project. And need to install bootstrap-sass version. I am using grunt-contrib-sass. But do I really need ruby installed? Can I modify grunt, so node-sass will be responsible for compilation?

userbb
  • 2,148
  • 5
  • 30
  • 53

1 Answers1

0

Following this example: https://github.com/sails101/using-sass

  1. Instead of grunt-contrib-sass, use grunt-sass instead to avoid the Ruby dependency:

    • Yarn: yarn add grunt-sass
    • NPM: npm i --save grunt-sass
  2. Install bootstrap-sass:

    • Yarn: yarn add bootstrap-sass
    • NPM: npm i --save bootstrap-sass
  3. Assuming you've followed along with the repo instructions linked above, we need to add bootstrap-sass to our imports in the sass.js config:

--

module.exports = function(grunt) {

  grunt.config.set('sass', {
    dev: {
      options: {
        includePaths: ['node_modules/bootstrap-sass/assets/stylesheets']
      },
      files: [{
        expand: true,
        cwd: 'assets/styles/',
        src: ['importer.scss'],
        dest: '.tmp/public/styles/',
        ext: '.css'
      }]
    }
  });

  grunt.loadNpmTasks('grunt-sass');
};
  1. Now we can simply do @import "bootstrap" in our sass.
Cisco
  • 20,972
  • 5
  • 38
  • 60