Giter Site home page Giter Site logo

Comments (4)

Mange avatar Mange commented on August 20, 2024

Implement your own provider and use that in the app. If you read the RDoc and look at the source for the other providers you will see how they work.

If the API isn't flexible enough, let me know.

from roadie.

mhenrixon avatar mhenrixon commented on August 20, 2024

I am trying with the following code and it works, finds the css file and reads it properly.

require 'pathname'
class SiteAssetsProvider < Roadie::AssetProvider

  attr_reader :path

  def find(name)
    arr = name.split('/')
    name = arr.pop
    path = resolve_path(arr.join('/'))
    file = path.join(name)
    if file.exist?
      file.read.strip
    else
      raise CSSFileNotFound.new(name, name.to_s)
    end
  end

  private
    def resolve_path(path)
      if path.kind_of?(Pathname)
        @path = path
      else
        pathname = Pathname.new(path)
        if pathname.absolute?
          @path = pathname
        else
          @path = Roadie.app.root.join(path)
        end
      end
    end
end

It however seems like something is missing because when it's used from the mailer it complains that the All method is undefined:

NoMethodError: undefined method `all' for SiteAssetsProvider:Class
from /Users/mhenrixon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/roadie-2.3.4/lib/roadie/inliner.rb:34:in `initialize'

What I don't get is why the method on the inherited AssetProvider class isn't called. Even if I define a method all on the SiteAssetsProvider class it isn't found or called.

from roadie.

mhenrixon avatar mhenrixon commented on August 20, 2024

Never mind I forgot to instantiate the provider :)

from roadie.

Mange avatar Mange commented on August 20, 2024

Let me know if you need anything else. :-)

from roadie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.