Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get stache to render .json files directly? #64

Open
jwir3 opened this issue Feb 20, 2017 · 0 comments
Open

Is it possible to get stache to render .json files directly? #64

jwir3 opened this issue Feb 20, 2017 · 0 comments

Comments

@jwir3
Copy link

jwir3 commented Feb 20, 2017

I'm using Pattern Lab to derive my mustache templates. Or, rather, I'm writing the templates in pattern lab, alongside a series of .json files. This works fine, but it's somewhat tedious to have to convert the data from .json to the member methods of a ruby class.

Is there a way to get stache to simply render data from a .json file instead? What I'm looking for is something like:

module Pages
  class About < ::Stache::Mustache::View
    def data
      file = File.read('data/about.json')
      return JSON.parse(file)
    end
  end
end
@jwir3 jwir3 changed the title Is is possible to get stache to render .json files directly? Is it possible to get stache to render .json files directly? Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant