How to use the node-sass/lib/extensions.getBinaryPath function in node-sass

To help you get started, we’ve selected a few node-sass examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ruowo / stdx / scripts / fetch.js View on Github external
return Promise.all(['win32', 'darwin', 'linux'].map(it => {
    let dir = dirMap[it] || 'linux'
    let binPath = require('node-sass/lib/extensions').getBinaryPath()
    // \stdx\node_modules\node-sass\vendor\win32-x64-57\binding.node
    binPath = path.join(__dirname, '../platform/$DIR$', path.relative(path.join(path.dirname(__dirname), 'node_modules'), binPath));
    // ..\platform\$DIR$\node-sass\vendor\win32-x64-57\binding.node
    binPath = binPath.replace(`${process.platform}-`, '$SYSTEM$')
    // ..\platform\$DIR$\node-sass\vendor\$SYSTEM$-x64-57\binding.node
    return spawn(path.join(__dirname, 'pnode', 'pnode-' + process.platform), 
      [require.resolve('node-sass/scripts/install')],
      {
        env: {
          SASS_CUSTOM_PLATFORM: it,
          SASS_BINARY_PATH: binPath.replace('$DIR$', dir).replace('$SYSTEM$', `${it}-`)
        }
      }
    )
  })).then(plog('downloadNodeSassAddions', 'done.'))
}