includePaths used with node-grunt is currently used incorrectly in Gruntfile.js
It currently is used as if require('node-bourbon').includePaths will return a single path, but instead it returns an array of paths (one path).
includePaths: ['<%= global_vars.theme_scss %>', require('node-bourbon').includePaths]

On the node bourbon page it recommends to use it as shown here:

var sass    = require('node-sass')
  , bourbon = require('node-bourbon').includePaths;

var paths = ['other/path', 'another/path'].concat(bourbon);

sass.render({
  file: './application.scss',
  success: function(css){
    console.log(css);
  },
  error: function(error) {
    console.log(error);
  },
  includePaths: paths,
  outputStyle: 'compressed'
});

Where the contents of includePaths is concatenated on the array of other include paths.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

westwesterson’s picture

Issue summary: View changes
westwesterson’s picture

I solved this locally, by replacing require('node-bourbon').includePaths with require('node-bourbon').includePaths[0] but I don't think this is the most elegant solution.

sass: {
      dist: {
        options: {
          outputStyle: 'compressed',
          includePaths: ['<%= global_vars.theme_scss %>', require('node-bourbon').includePaths[0]]
        },
        files: {
          '<%= global_vars.theme_css %>/<%= global_vars.theme_name %>.css': '<%= global_vars.theme_scss %>/<%= global_vars.theme_name %>.scss'
        }
      }
    },
westwesterson’s picture

Status: Active » Needs review

This is still broken, lets review the patch, and get this in core, otherwise grunt breaks!

kevinquillen’s picture

Where is the patch?

kevinquillen’s picture

Also what error are you getting? I am not getting one.

westwesterson’s picture

Including patch now, looks like i forgot to make one earlier.

To reproduce the error, try to use grunt watch. For me it was not working without the fix.
The fix is needed because require('node-bourbon').includePaths is an array of one item. This array is being embedded in the includePaths options array. Which makes a 2 level array, which the include paths option cannot handle.

as is the array looks like this

  • 'path to theme scss string'
  • array('path to node bourbon scss')

The fix is to make it so that instead it handles like this

  • 'path to theme scss string'
  • 'path to node bourbon scss'
westwesterson’s picture

if for some reason grunt is working for you, id be surprised if bourbon did... try using a mixin from the bourbon library.

  • shauntyndall committed 3b9c185 on 7.x-5.x
    Issue #2212527 by westwesterson: Bourbon include paths does not work...
shauntyndall’s picture

Status: Needs review » Fixed

I've adjusted the gruntfile in the 5.x-dev branch what I believe to be an "elegant" fashion. However, I'm really not able to replicate the grunt issues being described. So, this could still be a valid issue. Please reopen if so.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.