2

The Ruby library, Sprockets, allows you to set up an environment consisting of one or more load paths, and then can serve static files under those paths over HTTP.

It also will do ETags and preprocessing (for example, if you want to use CoffeeScript or Sass)

Has anyone written something like this in Haskell? (preferably using Wai?)

hdgarrood
  • 2,141
  • 16
  • 23
  • 1
    I don't have experience with sprockets, but wai-app-static and servius each perform functionality somewhat similar to what you're describing. Is that the kind of thing you're looking for? – Michael Snoyman Dec 25 '13 at 14:17
  • wai-app-static does almost everything I'm after, thanks :) – hdgarrood Dec 25 '13 at 14:36
  • The only thing that's missing is arbitrary preprocessors. If I could tell a wai-app-static application that, for example, to make a CSS file, it should take the corresponding SCSS file and run "sass" on it, that would be perfect. I suppose I'd need to write that myself? Does that fall within the scope of wai-app-static or would it have to be a separate package? – hdgarrood Dec 25 '13 at 14:39
  • 1
    That kind of a job might be even better suited to a WAI middleware, which would intercept a ResponseFile with a given file extension and preprocess the file. – Michael Snoyman Dec 25 '13 at 17:47
  • ah, of course -- thanks :) That answers everything. If you make your comments into an answer, I'll accept it. – hdgarrood Dec 26 '13 at 00:23

1 Answers1

1

wai-app-static provides a WAI application for serving static files. This could be combined with a WAI middleware to preprocess ResponseFile constructors with certain file extension to deliver the desired functionality.

Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77