sass / sassc-ruby

Use libsass with Ruby!
MIT License
363 stars 157 forks source link

how to migrate ruby-sass custom functions? #163

Open josh-m-sharpe opened 5 years ago

josh-m-sharpe commented 5 years ago

How do I migrate this ruby sass custom function to SassC? In a rails project, I just included this module in my application.rb and the likes of my-method would be available in my sass files.

The ruby sass EOL blog posts suggests I should just sub "SassC" for "Sass" but that doesn't work. Digging in I don't see any of these methods defined in SassC either.

Thanks!

module Sass::Script::Functions

  def my_method(string)
    assert_type string, :String

    prepend_host('prepend_thing', string)
  end
  declare :my_method, [:string]
end

Other blog post describing the implementation: http://www.seancolombo.com/2010/07/28/how-to-make-and-use-a-custom-sass-function/

amcaplan commented 5 years ago

I've had the same issue. I'm trying to figure out how to get a function to accept arbitrary keyword arguments, as before, and there doesn't seem to be a way built in.

josh-m-sharpe commented 5 years ago

@amcaplan Have you had any success on this?

amcaplan commented 5 years ago

Sorry @josh-m-sharpe, I haven't had time to pursue this further.

josh-m-sharpe commented 4 years ago

@bolandrm Sorry to ping - can you advise whether this was migrated or not? Happy to dig in and submit a patch, but I don't want to reinvent the wheel if it's already ported.

If it hasn't been ported, some advisement on implementation would be appreciated.

Thanks!