linkedin / eyeglass

NPM Modules for Sass
741 stars 60 forks source link

Question: Is bundling custom C function out of the scope for eyeglass? #6

Closed xzyfer closed 9 years ago

xzyfer commented 9 years ago

Is bundling custom C function out of the scope for eyeglass?

Pretty self explanatory. Being able to distribute, install and register custom Libsass C functions would be great. It would certainly ease the distribution of custom behaviour without requiring the forking of Libsass (this is a decision I'm currently facing in my team).

jakobo commented 9 years ago

It's well within scope. Given the way gyp files work, it's completely reasonable. If you can require() the node module (with it's gyp bindings), you should be able to register those calls as part of a custom function as well. The idea is to bring all of the great things about node and npm to the Sass system. :)

[edit] A hypothetical eyeglass-module

var myCStuff = require("./my-c-stuff");
module.exports = function(eyeglass, sass) {
  return {
    functions: {
      "signature()": function() {
        // just use myCStuff and handle converting results into proper sass.types
        // signature() will become a supported Sass custom function
      }
    }
  }
}
xzyfer commented 9 years ago

I could hug you. Happy to assist in anyway from the Libsass side of things.

chriseppstein commented 9 years ago

Agree. We will probably end up doing something like this for our spriting module. Hugs all around!